Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/apm/cmd_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ func runConfigGet(args []string) int {
fmt.Fprintf(os.Stderr, "[>] Valid keys: auto-integrate, temp-dir\n")
return 1
}
path := configPath()
if val, found := readConfigKey(path, key); found {
fmt.Printf("%s: %s\n", key, val)
return 0
}
// Return default when key is not set in config file.
switch key {
case "auto-integrate":
fmt.Printf("auto-integrate: true\n")
Expand Down Expand Up @@ -140,6 +146,15 @@ func runConfigUnset(args []string) int {
fmt.Fprintf(os.Stderr, "[>] Valid keys: auto-integrate, temp-dir\n")
return 1
}
path := configPath()
if path == "" {
fmt.Fprintf(os.Stderr, "[x] Could not determine config path.\n")
return 1
}
if err := removeConfigKey(path, key); err != nil {
fmt.Fprintf(os.Stderr, "[x] Failed to update config: %v\n", err)
return 1
}
fmt.Printf("[+] Config unset: %s\n", key)
return 0
}
12 changes: 12 additions & 0 deletions cmd/apm/cmd_deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func runDepsList(args []string) int {
fmt.Println(" List installed APM dependencies")
fmt.Println()
fmt.Println("Options:")
fmt.Println(" -g, --global List user-scope dependencies")
fmt.Println(" --all Include all dependency scopes")
fmt.Println(" --insecure Include insecure dependencies")
fmt.Println(" --help Show this message and exit.")
return 0
}
Expand Down Expand Up @@ -121,6 +124,7 @@ func runDepsTree(args []string) int {
fmt.Println(" Show dependency tree structure")
fmt.Println()
fmt.Println("Options:")
fmt.Println(" -g, --global Show user-scope dependency tree")
fmt.Println(" --help Show this message and exit.")
return 0
}
Expand Down Expand Up @@ -218,6 +222,8 @@ func runDepsClean(args []string) int {
fmt.Println(" Remove all APM dependencies")
fmt.Println()
fmt.Println("Options:")
fmt.Println(" --dry-run Show what would be removed without removing")
fmt.Println(" --yes, -y Skip confirmation prompt")
fmt.Println(" --help Show this message and exit.")
return 0
}
Expand Down Expand Up @@ -254,6 +260,12 @@ func runDepsUpdate(args []string) int {
fmt.Println(" Update APM dependencies to latest refs")
fmt.Println()
fmt.Println("Options:")
fmt.Println(" --verbose, -v Show detailed output")
fmt.Println(" --force Force dependency refresh")
fmt.Println(" --target, -t TARGET Target harness to update")
fmt.Println(" --parallel-downloads INTEGER Max concurrent downloads")
fmt.Println(" --global, -g Update user-scope dependencies")
fmt.Println(" --legacy-skill-paths Use legacy per-client skill paths")
fmt.Println(" --help Show this message and exit.")
return 0
}
Expand Down
35 changes: 35 additions & 0 deletions cmd/apm/cmd_lockfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,38 @@ func writeConfigKey(path, key, value string) error {
}
return os.WriteFile(path, []byte(newContent), 0o644)
}

// readConfigKey reads a top-level key from a simple YAML config file.
// Returns the value and true if found, or empty string and false if not.
func readConfigKey(path, key string) (string, bool) {
data, err := os.ReadFile(path)
if err != nil {
return "", false
}
prefix := key + ":"
for _, line := range strings.Split(string(data), "\n") {
trimmed := strings.TrimSpace(line)
if strings.HasPrefix(trimmed, prefix) {
val := strings.TrimSpace(trimmed[len(prefix):])
return val, true
}
}
return "", false
}

// removeConfigKey removes a top-level key line from a simple YAML config file.
func removeConfigKey(path, key string) error {
data, err := os.ReadFile(path)
if err != nil {
return nil // nothing to remove if file doesn't exist
}
prefix := key + ":"
lines := strings.Split(string(data), "\n")
var out []string
for _, l := range lines {
if !strings.HasPrefix(strings.TrimSpace(l), prefix) {
out = append(out, l)
}
}
return os.WriteFile(path, []byte(strings.Join(out, "\n")), 0o644)
}
Loading
Loading