fix up a number of misplace commands

* ps now on main command
* sign is no longer on main commmand
* ls, list no longer are valid main aliases for images
* ls, list does work for podman image

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2019-02-27 12:26:35 -06:00
parent 5afae0b25b
commit 3fa1fdf711
6 changed files with 20 additions and 9 deletions

View File

@ -18,7 +18,7 @@ func getMainCommands() []*cobra.Command {
_execCommand, _execCommand,
_generateCommand, _generateCommand,
_playCommand, _playCommand,
_psCommand, &_psCommand,
_loginCommand, _loginCommand,
_logoutCommand, _logoutCommand,
_logsCommand, _logsCommand,
@ -54,6 +54,10 @@ func getImageSubCommands() []*cobra.Command {
// Commands that the local client implements // Commands that the local client implements
func getContainerSubCommands() []*cobra.Command { func getContainerSubCommands() []*cobra.Command {
var _listSubCommand = _psCommand
_listSubCommand.Use = "list"
return []*cobra.Command{ return []*cobra.Command{
_attachCommand, _attachCommand,
_checkpointCommand, _checkpointCommand,
@ -64,8 +68,8 @@ func getContainerSubCommands() []*cobra.Command {
_execCommand, _execCommand,
_exportCommand, _exportCommand,
_killCommand, _killCommand,
&_listSubCommand,
_logsCommand, _logsCommand,
_psCommand,
_mountCommand, _mountCommand,
_pauseCommand, _pauseCommand,
_portCommand, _portCommand,

View File

@ -18,11 +18,13 @@ var containerCommand = cliconfig.PodmanCommand{
// Commands that are universally implemented. // Commands that are universally implemented.
var containerCommands = []*cobra.Command{ var containerCommands = []*cobra.Command{
_containerExistsCommand, _containerExistsCommand,
_inspectCommand,
} }
func init() { func init() {
containerCommand.AddCommand(containerCommands...) containerCommand.AddCommand(containerCommands...)
containerCommand.AddCommand(getContainerSubCommands()...) containerCommand.AddCommand(getContainerSubCommands()...)
containerCommand.SetUsageTemplate(UsageTemplate()) containerCommand.SetUsageTemplate(UsageTemplate())
rootCmd.AddCommand(containerCommand.Command) rootCmd.AddCommand(containerCommand.Command)
} }

View File

@ -15,6 +15,7 @@ var (
}, },
} }
_imagesSubCommand = _imagesCommand _imagesSubCommand = _imagesCommand
_rmSubCommand = _rmiCommand
) )
//imageSubCommands are implemented both in local and remote clients //imageSubCommands are implemented both in local and remote clients
@ -28,7 +29,6 @@ var imageSubCommands = []*cobra.Command{
_pruneImagesCommand, _pruneImagesCommand,
_pullCommand, _pullCommand,
_pushCommand, _pushCommand,
_rmiCommand,
_saveCommand, _saveCommand,
_tagCommand, _tagCommand,
} }
@ -38,7 +38,12 @@ func init() {
imageCommand.AddCommand(imageSubCommands...) imageCommand.AddCommand(imageSubCommands...)
imageCommand.AddCommand(getImageSubCommands()...) imageCommand.AddCommand(getImageSubCommands()...)
_imagesSubCommand.Aliases = []string{"ls", "list"} // Setup of "images" to appear as "list"
_imagesSubCommand.Use = "list"
_imagesSubCommand.Aliases = []string{"ls"}
imageCommand.AddCommand(&_imagesSubCommand) imageCommand.AddCommand(&_imagesSubCommand)
// Setup of "rmi" to appears as "rm"
_rmSubCommand.Use = "rm"
imageCommand.AddCommand(&_rmSubCommand)
} }

View File

@ -47,7 +47,7 @@ var mainCommands = []*cobra.Command{
podCommand.Command, podCommand.Command,
_pullCommand, _pullCommand,
_pushCommand, _pushCommand,
_rmiCommand, &_rmiCommand,
_saveCommand, _saveCommand,
_tagCommand, _tagCommand,
_versionCommand, _versionCommand,

View File

@ -157,7 +157,7 @@ func (a psSortedSize) Less(i, j int) bool {
var ( var (
psCommand cliconfig.PsValues psCommand cliconfig.PsValues
psDescription = "Prints out information about the containers" psDescription = "Prints out information about the containers"
_psCommand = &cobra.Command{ _psCommand = cobra.Command{
Use: "ps", Use: "ps",
Short: "List containers", Short: "List containers",
Long: psDescription, Long: psDescription,
@ -173,7 +173,7 @@ var (
) )
func init() { func init() {
psCommand.Command = _psCommand psCommand.Command = &_psCommand
psCommand.SetUsageTemplate(UsageTemplate()) psCommand.SetUsageTemplate(UsageTemplate())
flags := psCommand.Flags() flags := psCommand.Flags()
flags.BoolVarP(&psCommand.All, "all", "a", false, "Show all the containers, default is only running containers") flags.BoolVarP(&psCommand.All, "all", "a", false, "Show all the containers, default is only running containers")

View File

@ -14,7 +14,7 @@ import (
var ( var (
rmiCommand cliconfig.RmiValues rmiCommand cliconfig.RmiValues
rmiDescription = "Removes one or more locally stored images." rmiDescription = "Removes one or more locally stored images."
_rmiCommand = &cobra.Command{ _rmiCommand = cobra.Command{
Use: "rmi [flags] IMAGE [IMAGE...]", Use: "rmi [flags] IMAGE [IMAGE...]",
Short: "Removes one or more images from local storage", Short: "Removes one or more images from local storage",
Long: rmiDescription, Long: rmiDescription,
@ -30,7 +30,7 @@ var (
) )
func init() { func init() {
rmiCommand.Command = _rmiCommand rmiCommand.Command = &_rmiCommand
rmiCommand.SetUsageTemplate(UsageTemplate()) rmiCommand.SetUsageTemplate(UsageTemplate())
flags := rmiCommand.Flags() flags := rmiCommand.Flags()
flags.BoolVarP(&rmiCommand.All, "all", "a", false, "Remove all images") flags.BoolVarP(&rmiCommand.All, "all", "a", false, "Remove all images")