feat(completions): wire up key completions for key commands

This commit is contained in:
Lewis Wynne 2026-03-16 16:31:57 +00:00
parent 84b1c67c72
commit bc0b98c7f9
5 changed files with 32 additions and 25 deletions

View file

@ -24,6 +24,7 @@ Metadata flags (--ttl, --encrypt, --decrypt) can be passed alongside the edit
to modify metadata in the same operation.`,
Aliases: []string{"e"},
Args: cobra.ExactArgs(1),
ValidArgsFunction: completeKeys,
RunE: edit,
SilenceUsage: true,
}

View file

@ -48,6 +48,7 @@ For example:
pda get greeting NAME=World`,
Aliases: []string{"g"},
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: completeKeys,
RunE: get,
SilenceUsage: true,
}
@ -64,6 +65,7 @@ For example:
pda set greeting 'Hello, {{ .NAME }}!'
pda run greeting NAME=World`,
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: completeKeys,
RunE: run,
SilenceUsage: true,
}

View file

@ -15,6 +15,7 @@ without changing its value.
With no flags, displays the key's current metadata. Pass flags to modify.`,
Args: cobra.ExactArgs(1),
ValidArgsFunction: completeKeys,
RunE: meta,
SilenceUsage: true,
}

View file

@ -34,6 +34,7 @@ var cpCmd = &cobra.Command{
Aliases: []string{"cp"},
Short: "Make a copy of a key",
Args: cobra.ExactArgs(2),
ValidArgsFunction: completeKeys,
RunE: cp,
SilenceUsage: true,
}
@ -43,6 +44,7 @@ var mvCmd = &cobra.Command{
Aliases: []string{"mv"},
Short: "Move a key",
Args: cobra.ExactArgs(2),
ValidArgsFunction: completeKeys,
RunE: mv,
SilenceUsage: true,
}

View file

@ -52,6 +52,7 @@ For example:
'{{ enum .NAME "Alice" "Bob" }}' allows only NAME=Alice or NAME=Bob.`,
Aliases: []string{"s"},
Args: cobra.RangeArgs(1, 2),
ValidArgsFunction: completeKeys,
RunE: set,
SilenceUsage: true,
}