mirror of
https://github.com/docker/cli.git
synced 2026-10-25 07:11:52 -04:00
This fix is part of the effort to convert commands to spf13/cobra #23211. Thif fix coverted command `docker version` to use spf13/cobra NOTE: Most of the commands like `run`, `images` etc. goes to packages of `container`, `image`, `network`, etc. Didn't find a good place for `docker version` so just use the package `client` for now. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> Upstream-commit: bc82e51d7755e54dc6d0dcb93e6250bbff0bbd59 Component: engine
27 lines
694 B
Go
27 lines
694 B
Go
package client
|
|
|
|
// Command returns a cli command handler if one exists
|
|
func (cli *DockerCli) Command(name string) func(...string) error {
|
|
return map[string]func(...string) error{
|
|
"build": cli.CmdBuild,
|
|
"commit": cli.CmdCommit,
|
|
"cp": cli.CmdCp,
|
|
"events": cli.CmdEvents,
|
|
"exec": cli.CmdExec,
|
|
"images": cli.CmdImages,
|
|
"info": cli.CmdInfo,
|
|
"inspect": cli.CmdInspect,
|
|
"load": cli.CmdLoad,
|
|
"login": cli.CmdLogin,
|
|
"logout": cli.CmdLogout,
|
|
"ps": cli.CmdPs,
|
|
"pull": cli.CmdPull,
|
|
"push": cli.CmdPush,
|
|
"rm": cli.CmdRm,
|
|
"save": cli.CmdSave,
|
|
"stats": cli.CmdStats,
|
|
"tag": cli.CmdTag,
|
|
"update": cli.CmdUpdate,
|
|
}[name]
|
|
}
|