Replace boolean flags with subcommands (flag.NewFlagSet per command) #163

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

The old interface is a set of mutually exclusive boolean flags plus shared modifiers (-year, -leg, -filename) that only apply to some of them. Replace it with a command table (name → description + run func). Each command defines only the flags it needs, so syncer polls --leg=57 is rejected instead of silently ignored.

Proposed mapping:

Old flag New command Own flags
-syncTables tables none
-syncHistory project-history none
-syncHistoryChanged project-history-changed none
-syncAmendments amendments none
-updateAmendmentMembers amendment-deputies none
-syncQuotaExpTypes quota-expense-types none
-syncQuotaExpenses quota-expenses --year
-syncPolls polls --year
-syncPollObjects poll-objects --year
-syncPollProjects poll-projects --year
-syncPollVotes poll-votes --year
-syncSession session --filename (required)
-getLegislatures legislatures none
-syncLegLawmakerCodeMembers leg-lawmaker-code-members --leg
-syncDeputies deputies --leg

Acceptance criteria:

  • syncer -h shows only that command's flags
  • All 15 commands are registered
The old interface is a set of mutually exclusive boolean flags plus shared modifiers (-year, -leg, -filename) that only apply to some of them. Replace it with a command table (name → description + run func). Each command defines only the flags it needs, so syncer polls --leg=57 is rejected instead of silently ignored. Proposed mapping: | Old flag | New command | Own flags | |---|---|---| | -syncTables | tables | none | | -syncHistory | project-history | none | | -syncHistoryChanged | project-history-changed | none | | -syncAmendments | amendments | none | | -updateAmendmentMembers | amendment-deputies | none | | -syncQuotaExpTypes | quota-expense-types | none | | -syncQuotaExpenses | quota-expenses | --year | | -syncPolls | polls | --year | | -syncPollObjects | poll-objects | --year | | -syncPollProjects | poll-projects | --year | | -syncPollVotes | poll-votes | --year | | -syncSession | session | --filename (required) | | -getLegislatures | legislatures | none | | -syncLegLawmakerCodeMembers | leg-lawmaker-code-members | --leg | | -syncDeputies | deputies | --leg | Acceptance criteria: - syncer <command> -h shows only that command's flags - All 15 commands are registered
aniram added this to the 2027.1 milestone 2026-10-07 11:56:08 +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#163
No description provided.