feat(completions): wire up key completions for key commands
This commit is contained in:
parent
84b1c67c72
commit
bc0b98c7f9
5 changed files with 32 additions and 25 deletions
|
|
@ -24,6 +24,7 @@ Metadata flags (--ttl, --encrypt, --decrypt) can be passed alongside the edit
|
||||||
to modify metadata in the same operation.`,
|
to modify metadata in the same operation.`,
|
||||||
Aliases: []string{"e"},
|
Aliases: []string{"e"},
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
|
ValidArgsFunction: completeKeys,
|
||||||
RunE: edit,
|
RunE: edit,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ For example:
|
||||||
pda get greeting NAME=World`,
|
pda get greeting NAME=World`,
|
||||||
Aliases: []string{"g"},
|
Aliases: []string{"g"},
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
ValidArgsFunction: completeKeys,
|
||||||
RunE: get,
|
RunE: get,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
@ -64,6 +65,7 @@ For example:
|
||||||
pda set greeting 'Hello, {{ .NAME }}!'
|
pda set greeting 'Hello, {{ .NAME }}!'
|
||||||
pda run greeting NAME=World`,
|
pda run greeting NAME=World`,
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
ValidArgsFunction: completeKeys,
|
||||||
RunE: run,
|
RunE: run,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ without changing its value.
|
||||||
|
|
||||||
With no flags, displays the key's current metadata. Pass flags to modify.`,
|
With no flags, displays the key's current metadata. Pass flags to modify.`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
|
ValidArgsFunction: completeKeys,
|
||||||
RunE: meta,
|
RunE: meta,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ var cpCmd = &cobra.Command{
|
||||||
Aliases: []string{"cp"},
|
Aliases: []string{"cp"},
|
||||||
Short: "Make a copy of a key",
|
Short: "Make a copy of a key",
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
|
ValidArgsFunction: completeKeys,
|
||||||
RunE: cp,
|
RunE: cp,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +44,7 @@ var mvCmd = &cobra.Command{
|
||||||
Aliases: []string{"mv"},
|
Aliases: []string{"mv"},
|
||||||
Short: "Move a key",
|
Short: "Move a key",
|
||||||
Args: cobra.ExactArgs(2),
|
Args: cobra.ExactArgs(2),
|
||||||
|
ValidArgsFunction: completeKeys,
|
||||||
RunE: mv,
|
RunE: mv,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ For example:
|
||||||
'{{ enum .NAME "Alice" "Bob" }}' allows only NAME=Alice or NAME=Bob.`,
|
'{{ enum .NAME "Alice" "Bob" }}' allows only NAME=Alice or NAME=Bob.`,
|
||||||
Aliases: []string{"s"},
|
Aliases: []string{"s"},
|
||||||
Args: cobra.RangeArgs(1, 2),
|
Args: cobra.RangeArgs(1, 2),
|
||||||
|
ValidArgsFunction: completeKeys,
|
||||||
RunE: set,
|
RunE: set,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue