summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-13 17:37:16 +0300
committerPaul Buetow <paul@buetow.org>2025-07-13 17:37:16 +0300
commitfa5ef028ec9a7af801710eed190057d3b3c172f0 (patch)
tree41ef41dd1edace0438be20c4f35328c0fbfd8090 /internal/config
parent79225d4df3a181f08a2160ff8ec361001b9dea18 (diff)
refactor: restructure CLI with cobra command framework
- Replace flat flags with organized command structure - Add commands: sync, list, manage, release, showcase, test - Implement subcommands for better organization: - sync: repo, all, codeberg-to-github, github-to-codeberg, bidirectional - list: orgs, repos - manage: delete-repo, clean, batch-run - release: check, create (with --ai-notes support) - showcase: with --force, --output, --format, --exclude - test: github-token, codeberg-token, config - Add comprehensive help with examples for all commands - Fix config loading bug when path is empty - Update README.md with new command structure and examples - Maintain backward compatibility (old flags still work with warnings) The new structure provides better discoverability, consistent naming, and logical grouping of related functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index cb27058..799c792 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -28,8 +28,15 @@ type Config struct {
// Load reads and parses the configuration file
func Load(path string) (*Config, error) {
- // Expand home directory if needed
- if path[:2] == "~/" {
+ // If no path provided, use default
+ if path == "" {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return nil, fmt.Errorf("failed to get home directory: %w", err)
+ }
+ path = filepath.Join(home, ".gitsyncer.json")
+ } else if len(path) >= 2 && path[:2] == "~/" {
+ // Expand home directory if needed
home, err := os.UserHomeDir()
if err != nil {
return nil, fmt.Errorf("failed to get home directory: %w", err)