feat(cli): add apply subcommand

This commit is contained in:
2026-05-23 03:32:21 +01:00
parent 85fbbafb71
commit 68035b378c
15 changed files with 889 additions and 1 deletions
+20 -1
View File
@@ -1,7 +1,13 @@
// Package cli provides the cobra command tree for harness-sync.
package cli
import "github.com/spf13/cobra"
import (
"fmt"
"os"
"path/filepath"
"github.com/spf13/cobra"
)
func NewRoot(version string) *cobra.Command {
return &cobra.Command{
@@ -11,3 +17,16 @@ func NewRoot(version string) *cobra.Command {
SilenceUsage: true,
}
}
// resolveRoot returns the canonical root: the flag value when non-empty,
// else $HOME/.config/harness-sync.
func resolveRoot(flag string) (string, error) {
if flag != "" {
return flag, nil
}
home, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("resolve home dir: %w", err)
}
return filepath.Join(home, ".config", "harness-sync"), nil
}