diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-03 22:38:37 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-03 22:38:37 +0300 |
| commit | 64095a2c8d5a3a72c55d7bd0737c5542a5aeee09 (patch) | |
| tree | 0af2501374550e8fdadd4df00d245c6260c0305d /internal/cli | |
| parent | 0c072d964d4d07e69d1c0af1f3b09f9adc543571 (diff) | |
feat: add SSH backup locations with --backup flagv0.2.0
- Add support for SSH backup locations (e.g., paul@server:git/)
- Backup locations are one-way only (push only, never pull)
- Automatic bare repository creation on SSH servers
- Add --backup flag to opt-in to backup syncing
- Backup locations are disabled by default for offline resilience
- Update version to 0.2.0
This allows users to maintain private backups on home servers that may
be offline without affecting regular sync operations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/cli')
| -rw-r--r-- | internal/cli/flags.go | 2 | ||||
| -rw-r--r-- | internal/cli/sync_handlers.go | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/internal/cli/flags.go b/internal/cli/flags.go index 71708a2..322ad5a 100644 --- a/internal/cli/flags.go +++ b/internal/cli/flags.go @@ -24,6 +24,7 @@ type Flags struct { TestGitHubToken bool Clean bool DeleteRepo string + Backup bool } // ParseFlags parses command-line flags and returns the flags struct @@ -48,6 +49,7 @@ func ParseFlags() *Flags { 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.StringVar(&f.DeleteRepo, "delete-repo", "", "delete specified repository from all configured organizations (with confirmation)") + flag.BoolVar(&f.Backup, "backup", false, "enable syncing to backup locations") flag.Parse() diff --git a/internal/cli/sync_handlers.go b/internal/cli/sync_handlers.go index c1fefb6..619b01e 100644 --- a/internal/cli/sync_handlers.go +++ b/internal/cli/sync_handlers.go @@ -22,6 +22,7 @@ func HandleSync(cfg *config.Config, flags *Flags) int { } syncer := sync.New(cfg, flags.WorkDir) + syncer.SetBackupEnabled(flags.Backup) if err := syncer.SyncRepository(flags.SyncRepo); err != nil { log.Fatal("Sync failed:", err) return 1 @@ -47,6 +48,7 @@ func HandleSyncAll(cfg *config.Config, flags *Flags) int { } syncer := sync.New(cfg, flags.WorkDir) + syncer.SetBackupEnabled(flags.Backup) successCount := 0 for i, repo := range cfg.Repositories { @@ -264,6 +266,7 @@ func syncCodebergRepos(cfg *config.Config, flags *Flags, repos []codeberg.Reposi fmt.Printf("\nStarting sync of %d repositories...\n", len(repoNames)) syncer := sync.New(cfg, flags.WorkDir) + syncer.SetBackupEnabled(flags.Backup) successCount := 0 // Create map for descriptions @@ -329,6 +332,7 @@ func syncGitHubRepos(cfg *config.Config, flags *Flags, repos []github.Repository fmt.Printf("\nStarting sync of %d repositories...\n", len(repoNames)) syncer := sync.New(cfg, flags.WorkDir) + syncer.SetBackupEnabled(flags.Backup) successCount := 0 // Create map for descriptions |
