From 90e3fc07894c754364809c4733e403bf4fdeb484 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 29 May 2026 09:55:12 +0300 Subject: refactor(cli): remove dead legacy flag layer (rq) --- doc/development.md | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'doc/development.md') diff --git a/doc/development.md b/doc/development.md index 75274f0..0d80958 100644 --- a/doc/development.md +++ b/doc/development.md @@ -300,28 +300,22 @@ test: add integration tests for branch filtering ### Adding a New Command Flag -1. Add flag in `internal/cli/flags.go`: +1. Add a Cobra flag on the relevant command in `internal/cmd/*.go`: ```go - type Flags struct { - // ... existing flags - NewFeature bool // Add new flag - } - - func ParseFlags() *Flags { - flags := &Flags{} - // ... existing flags - flag.BoolVar(&flags.NewFeature, "new-feature", false, "Enable new feature") - } + myCmd.Flags().BoolVar(&newFeature, "new-feature", false, "enable new feature") ``` -2. Handle flag in `cmd/gitsyncer/main.go`: +2. Pass it through `buildFlags()` when a `cli.Flags` value is required: ```go - if flags.NewFeature { - os.Exit(cli.HandleNewFeature(cfg, flags)) + func buildFlags() *cli.Flags { + return &cli.Flags{ + // ... existing fields + NewFeature: newFeature, + } } ``` -3. Implement handler in `internal/cli/handlers.go` +3. Wire behavior in the command `Run` function and/or `internal/cli` handler. ### Adding a New Configuration Option @@ -442,4 +436,4 @@ GITSYNCER_DEBUG=1 gitsyncer --sync test-repo ```bash mage buildAll ``` -5. Create GitHub/Codeberg release with binaries \ No newline at end of file +5. Create GitHub/Codeberg release with binaries -- cgit v1.2.3