Skip to content

Commit

Permalink
commands: introduce plugin as alias to plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajolet-hashicorp committed Mar 5, 2024
1 parent c5899f2 commit 8ae73e2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
32 changes: 32 additions & 0 deletions command/plugin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package command

import (
"strings"

"github.com/mitchellh/cli"
)

type PluginCommand struct {
Meta
}

func (c *PluginCommand) Synopsis() string {
return "Alias to `packer plugins` - Interact with Packer plugins and catalog"
}

func (c *PluginCommand) Help() string {
helpText := `
Usage: packer plugin <subcommand> [options] [args]
This command groups subcommands for interacting with Packer plugins.
Related but not under the "plugin" command :
- "packer init <path>" will install all plugins required by a config.
`

return strings.TrimSpace(helpText)
}

func (c *PluginCommand) Run(args []string) int {
return cli.RunResultHelp
}
26 changes: 26 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,56 @@ func init() {
}, nil
},

"plugin": func() (cli.Command, error) {
return &command.PluginCommand{
Meta: *CommandMeta,
}, nil
},

"plugins": func() (cli.Command, error) {
return &command.PluginsCommand{
Meta: *CommandMeta,
}, nil
},

"plugin installed": func() (cli.Command, error) {
return &command.PluginsInstalledCommand{
Meta: *CommandMeta,
}, nil
},
"plugins installed": func() (cli.Command, error) {
return &command.PluginsInstalledCommand{
Meta: *CommandMeta,
}, nil
},

"plugin install": func() (cli.Command, error) {
return &command.PluginsInstallCommand{
Meta: *CommandMeta,
}, nil
},
"plugins install": func() (cli.Command, error) {
return &command.PluginsInstallCommand{
Meta: *CommandMeta,
}, nil
},

"plugin remove": func() (cli.Command, error) {
return &command.PluginsRemoveCommand{
Meta: *CommandMeta,
}, nil
},
"plugins remove": func() (cli.Command, error) {
return &command.PluginsRemoveCommand{
Meta: *CommandMeta,
}, nil
},

"plugin required": func() (cli.Command, error) {
return &command.PluginsRequiredCommand{
Meta: *CommandMeta,
}, nil
},
"plugins required": func() (cli.Command, error) {
return &command.PluginsRequiredCommand{
Meta: *CommandMeta,
Expand Down

0 comments on commit 8ae73e2

Please sign in to comment.