mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
Plugins: Add -version flag to 'vault plugin info' (#17454)
* Add -version flag to 'vault plugin info' * Allow specifying a builtin tag when reading a single plugin from the catalog
This commit is contained in:
@@ -17,6 +17,8 @@ var (
|
||||
|
||||
type PluginInfoCommand struct {
|
||||
*BaseCommand
|
||||
|
||||
flagVersion string
|
||||
}
|
||||
|
||||
func (c *PluginInfoCommand) Synopsis() string {
|
||||
@@ -41,7 +43,18 @@ Usage: vault plugin info [options] TYPE NAME
|
||||
}
|
||||
|
||||
func (c *PluginInfoCommand) Flags() *FlagSets {
|
||||
return c.flagSet(FlagSetHTTP | FlagSetOutputField | FlagSetOutputFormat)
|
||||
set := c.flagSet(FlagSetHTTP | FlagSetOutputField | FlagSetOutputFormat)
|
||||
|
||||
f := set.NewFlagSet("Command Options")
|
||||
|
||||
f.StringVar(&StringVar{
|
||||
Name: "version",
|
||||
Target: &c.flagVersion,
|
||||
Completion: complete.PredictAnything,
|
||||
Usage: "Semantic version of the plugin. Optional.",
|
||||
})
|
||||
|
||||
return set
|
||||
}
|
||||
|
||||
func (c *PluginInfoCommand) AutocompleteArgs() complete.Predictor {
|
||||
@@ -93,8 +106,9 @@ func (c *PluginInfoCommand) Run(args []string) int {
|
||||
pluginName := strings.TrimSpace(pluginNameRaw)
|
||||
|
||||
resp, err := client.Sys().GetPlugin(&api.GetPluginInput{
|
||||
Name: pluginName,
|
||||
Type: pluginType,
|
||||
Name: pluginName,
|
||||
Type: pluginType,
|
||||
Version: c.flagVersion,
|
||||
})
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Sprintf("Error reading plugin named %s: %s", pluginName, err))
|
||||
@@ -113,6 +127,7 @@ func (c *PluginInfoCommand) Run(args []string) int {
|
||||
"name": resp.Name,
|
||||
"sha256": resp.SHA256,
|
||||
"deprecation_status": resp.DeprecationStatus,
|
||||
"version": resp.Version,
|
||||
}
|
||||
|
||||
if c.flagField != "" {
|
||||
|
||||
Reference in New Issue
Block a user