summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-29 09:55:12 +0300
committerPaul Buetow <paul@buetow.org>2026-05-29 09:55:12 +0300
commit90e3fc07894c754364809c4733e403bf4fdeb484 (patch)
treedba3e2d2297686c90b077b2734f3c5d9ea9a1e47 /doc
parent820c24ffb8bfdd2cd7cba1a5d599cbd6d092ad81 (diff)
refactor(cli): remove dead legacy flag layer (rq)
Diffstat (limited to 'doc')
-rw-r--r--doc/api-reference.md23
-rw-r--r--doc/development.md26
2 files changed, 11 insertions, 38 deletions
diff --git a/doc/api-reference.md b/doc/api-reference.md
index c189e99..b7ed2f8 100644
--- a/doc/api-reference.md
+++ b/doc/api-reference.md
@@ -24,7 +24,7 @@ The main package provides the application entry point.
#### func main()
Application entry point that:
-- Parses command-line flags
+- Initializes Cobra commands
- Routes to appropriate handlers
- Manages exit codes
@@ -60,36 +60,18 @@ type Flags struct {
### Functions
-#### func ParseFlags() *Flags
-Parses command-line arguments and returns a Flags struct with all options.
-
-#### func HandleVersion() int
-Displays version information and returns exit code 0.
-
#### func HandleTestGitHubToken() int
Tests GitHub token authentication:
- Loads token from config/env/file
- Validates token with API call
- Returns 0 on success, 1 on failure
-#### func LoadConfig(configPath string) (*config.Config, error)
-Loads configuration from specified path or default locations:
-- `./gitsyncer.json`
-- `~/.config/gitsyncer/config.json`
-- `~/.gitsyncer.json`
-
-#### func ShowConfigHelp()
-Displays help for creating configuration files with example.
-
#### func HandleListOrgs(cfg *config.Config) int
Lists all configured organizations from config.
#### func HandleListRepos(cfg *config.Config) int
Lists all configured repositories from config.
-#### func ShowUsage(cfg *config.Config)
-Displays comprehensive usage information.
-
#### func HandleSync(cfg *config.Config, flags *Flags) int
Synchronizes a single repository specified by `--sync` flag.
@@ -102,9 +84,6 @@ Discovers and syncs all public Codeberg repositories to other platforms.
#### func HandleSyncGitHubPublic(cfg *config.Config, flags *Flags) int
Discovers and syncs all public GitHub repositories to other platforms.
-#### func ShowFullSyncMessage()
-Displays information about full sync mode.
-
### Helper Functions (sync_handlers.go)
#### func createGitHubRepoIfNeeded(cfg *config.Config, repoName string) error
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