diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-29 09:55:12 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-29 09:55:12 +0300 |
| commit | 90e3fc07894c754364809c4733e403bf4fdeb484 (patch) | |
| tree | dba3e2d2297686c90b077b2734f3c5d9ea9a1e47 /doc/development.md | |
| parent | 820c24ffb8bfdd2cd7cba1a5d599cbd6d092ad81 (diff) | |
refactor(cli): remove dead legacy flag layer (rq)
Diffstat (limited to 'doc/development.md')
| -rw-r--r-- | doc/development.md | 26 |
1 files changed, 10 insertions, 16 deletions
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 |
