summaryrefslogtreecommitdiff
path: root/internal/cli
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cli')
-rw-r--r--internal/cli/flags.go19
-rw-r--r--internal/cli/handlers.go5
2 files changed, 20 insertions, 4 deletions
diff --git a/internal/cli/flags.go b/internal/cli/flags.go
index c0320c5..9b8afdc 100644
--- a/internal/cli/flags.go
+++ b/internal/cli/flags.go
@@ -1,6 +1,10 @@
package cli
-import "flag"
+import (
+ "flag"
+ "os"
+ "path/filepath"
+)
// Flags holds all command-line flag values
type Flags struct {
@@ -38,11 +42,22 @@ func ParseFlags() *Flags {
flag.BoolVar(&f.CreateGitHubRepos, "create-github-repos", false, "automatically create missing GitHub repositories")
flag.BoolVar(&f.CreateCodebergRepos, "create-codeberg-repos", false, "automatically create missing Codeberg repositories")
flag.BoolVar(&f.DryRun, "dry-run", false, "show what would be synced without actually syncing")
- flag.StringVar(&f.WorkDir, "work-dir", ".gitsyncer-work", "working directory for cloning repositories")
+ 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.Parse()
+ // Set default WorkDir if not provided
+ if f.WorkDir == "" {
+ home, err := os.UserHomeDir()
+ if err == nil {
+ f.WorkDir = filepath.Join(home, "git", "gitsyncer-workdir")
+ } else {
+ // Fallback if we can't get home directory
+ f.WorkDir = ".gitsyncer-work"
+ }
+ }
+
// Handle --full flag by enabling all sync operations
if f.FullSync {
f.SyncCodebergPublic = true
diff --git a/internal/cli/handlers.go b/internal/cli/handlers.go
index e2cad92..a2a9c94 100644
--- a/internal/cli/handlers.go
+++ b/internal/cli/handlers.go
@@ -103,7 +103,8 @@ func ShowConfigHelp() {
"^codex/",
"^temp-",
"-wip$"
- ]
+ ],
+ "work_dir": "~/git/gitsyncer-workdir"
}`)
}
@@ -146,7 +147,7 @@ func ShowUsage(cfg *config.Config) {
fmt.Println(" gitsyncer --version Show version information")
fmt.Println("\nOptions:")
fmt.Println(" --config <path> Path to configuration file")
- fmt.Println(" --work-dir <path> Working directory for operations (default: .gitsyncer-work)")
+ fmt.Println(" --work-dir <path> Working directory for operations (default: ~/git/gitsyncer-workdir)")
fmt.Println(" --create-github-repos Create missing GitHub repositories automatically")
fmt.Println(" --create-codeberg-repos Create missing Codeberg repositories (not yet implemented)")
fmt.Println(" --dry-run Show what would be done without doing it")