summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-26 00:30:13 +0300
committerPaul Buetow <paul@buetow.org>2025-06-26 00:30:13 +0300
commit15d06422f80ad7b9b10e5dc28104d3ba3abb2085 (patch)
tree4b2fb3902a19de43a5e41cb959729863a4ccca2d
parent7c30b68f29049704c7fafed8015169e9c8047e46 (diff)
add clean
-rw-r--r--cmd/gitsyncer/main.go5
-rw-r--r--internal/cli/flags.go2
2 files changed, 7 insertions, 0 deletions
diff --git a/cmd/gitsyncer/main.go b/cmd/gitsyncer/main.go
index 021d4be..04b65b7 100644
--- a/cmd/gitsyncer/main.go
+++ b/cmd/gitsyncer/main.go
@@ -26,6 +26,11 @@ func main() {
os.Exit(cli.HandleTestGitHubToken())
}
+ // Handle clean flag
+ if flags.Clean {
+ os.Exit(cli.HandleClean(flags))
+ }
+
// Load configuration
cfg, err := cli.LoadConfig(flags.ConfigPath)
if err != nil {
diff --git a/internal/cli/flags.go b/internal/cli/flags.go
index 9b8afdc..aac339e 100644
--- a/internal/cli/flags.go
+++ b/internal/cli/flags.go
@@ -22,6 +22,7 @@ type Flags struct {
DryRun bool
WorkDir string
TestGitHubToken bool
+ Clean bool
}
// ParseFlags parses command-line flags and returns the flags struct
@@ -44,6 +45,7 @@ func ParseFlags() *Flags {
flag.BoolVar(&f.DryRun, "dry-run", false, "show what would be synced without actually syncing")
flag.StringVar(&f.WorkDir, "work-dir", "", "working directory for cloning repositories (default: ~/git/gitsyncer-workdir)")
flag.BoolVar(&f.TestGitHubToken, "test-github-token", false, "test GitHub token authentication")
+ flag.BoolVar(&f.Clean, "clean", false, "delete all repositories in work directory (with confirmation)")
flag.Parse()