mirror of https://github.com/containers/podman.git
run/create: reserve `-h` flag for hostname
Move the `-h` short flag from `--help` to `--hostname` for podman-run, podman-create and podman-pod-create to be compatible with Docker. Fixes: #1367 Signed-off-by: Valentin Rothberg <vrothberg@suse.com> Closes: #1373 Approved by: rhatdan
This commit is contained in:
parent
65c31d49f9
commit
6751b2c350
|
@ -216,8 +216,12 @@ var createFlags = []cli.Flag{
|
||||||
Name: "group-add",
|
Name: "group-add",
|
||||||
Usage: "Add additional groups to join (default [])",
|
Usage: "Add additional groups to join (default [])",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "help",
|
||||||
|
Hidden: true,
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "hostname",
|
Name: "hostname, h",
|
||||||
Usage: "Set container hostname",
|
Usage: "Set container hostname",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
|
|
|
@ -49,6 +49,7 @@ var createCommand = cli.Command{
|
||||||
Flags: createFlags,
|
Flags: createFlags,
|
||||||
Action: createCmd,
|
Action: createCmd,
|
||||||
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
||||||
|
HideHelp: true,
|
||||||
SkipArgReorder: true,
|
SkipArgReorder: true,
|
||||||
UseShortOptionHandling: true,
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
|
@ -57,6 +58,12 @@ func createCmd(c *cli.Context) error {
|
||||||
// TODO should allow user to create based off a directory on the host not just image
|
// TODO should allow user to create based off a directory on the host not just image
|
||||||
// Need CLI support for this
|
// Need CLI support for this
|
||||||
|
|
||||||
|
// Docker-compatibility: the "-h" flag for run/create is reserved for
|
||||||
|
// the hostname (see https://github.com/containers/libpod/issues/1367).
|
||||||
|
if c.Bool("help") {
|
||||||
|
cli.ShowCommandHelpAndExit(c, "run", 0)
|
||||||
|
}
|
||||||
|
|
||||||
if err := validateFlags(c, createFlags); err != nil {
|
if err := validateFlags(c, createFlags); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ var podCreateCommand = cli.Command{
|
||||||
Description: podCreateDescription,
|
Description: podCreateDescription,
|
||||||
Flags: podCreateFlags,
|
Flags: podCreateFlags,
|
||||||
Action: podCreateCmd,
|
Action: podCreateCmd,
|
||||||
|
HideHelp: true,
|
||||||
SkipArgReorder: true,
|
SkipArgReorder: true,
|
||||||
UseShortOptionHandling: true,
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
|
@ -79,6 +80,12 @@ func podCreateCmd(c *cli.Context) error {
|
||||||
var options []libpod.PodCreateOption
|
var options []libpod.PodCreateOption
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
// Docker-compatibility: the "-h" flag for run/create is reserved for
|
||||||
|
// the hostname (see https://github.com/containers/libpod/issues/1367).
|
||||||
|
if c.Bool("help") {
|
||||||
|
cli.ShowCommandHelpAndExit(c, "run", 0)
|
||||||
|
}
|
||||||
|
|
||||||
if err = validateFlags(c, createFlags); err != nil {
|
if err = validateFlags(c, createFlags); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,20 @@ var runCommand = cli.Command{
|
||||||
Flags: runFlags,
|
Flags: runFlags,
|
||||||
Action: runCmd,
|
Action: runCmd,
|
||||||
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
ArgsUsage: "IMAGE [COMMAND [ARG...]]",
|
||||||
|
HideHelp: true,
|
||||||
SkipArgReorder: true,
|
SkipArgReorder: true,
|
||||||
UseShortOptionHandling: true,
|
UseShortOptionHandling: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCmd(c *cli.Context) error {
|
func runCmd(c *cli.Context) error {
|
||||||
var imageName string
|
var imageName string
|
||||||
|
|
||||||
|
// Docker-compatibility: the "-h" flag for run/create is reserved for
|
||||||
|
// the hostname (see https://github.com/containers/libpod/issues/1367).
|
||||||
|
if c.Bool("help") {
|
||||||
|
cli.ShowCommandHelpAndExit(c, "run", 0)
|
||||||
|
}
|
||||||
|
|
||||||
if err := validateFlags(c, createFlags); err != nil {
|
if err := validateFlags(c, createFlags); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,10 @@ var (
|
||||||
cmd = []string{"podman", "test", "alpine"}
|
cmd = []string{"podman", "test", "alpine"}
|
||||||
CLI *cli.Context
|
CLI *cli.Context
|
||||||
testCommand = cli.Command{
|
testCommand = cli.Command{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Flags: createFlags,
|
Flags: createFlags,
|
||||||
Action: testCmd,
|
Action: testCmd,
|
||||||
|
HideHelp: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue