Scaffold cmd/syncer with shared bootstrap #162

Open
opened 2026-10-07 11:52:54 +00:00 by aniram · 0 comments
Owner

Each of the 17 branches in the current code repeats the same ~12 lines: NewLogFile, defer Close, CustomLogger, syncer.New. Build this once.

main() only calls run(os.Args[1:]) and does os.Exit(1) on error, so deferred cleanup runs.
newApp() returns the syncer, logger and a cleanup function that closes the log file and the DB.
Commands receive the app and their args.
Unknown or missing command prints usage and exits non-zero.

Acceptance criteria:

  • Setup code exists in exactly one place.
  • Running syncer with no args or an unknown command prints helper message.
Each of the 17 branches in the current code repeats the same ~12 lines: NewLogFile, defer Close, CustomLogger, syncer.New. Build this once. main() only calls run(os.Args[1:]) and does os.Exit(1) on error, so deferred cleanup runs. newApp() returns the syncer, logger and a cleanup function that closes the log file and the DB. Commands receive the app and their args. Unknown or missing command prints usage and exits non-zero. Acceptance criteria: - Setup code exists in exactly one place. - Running syncer with no args or an unknown command prints helper message.
aniram added this to the 2027.1 milestone 2026-10-07 11:52:57 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
overdrives/chambersbr#162
No description provided.