mirror of https://github.com/containers/podman.git
Prohibit use of positional args with --import
I took the liberty of combining related checks together so as to avoid a little duplication; if this is not a Go best practice, I will revert. I also made a minor wording adjustment to an error message for clarity. Also: update wording of man page. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
parent
bd0582dd34
commit
9f49c1af46
|
@ -76,11 +76,16 @@ func restoreCmd(c *cliconfig.RestoreValues, cmd *cobra.Command) error {
|
||||||
return errors.Errorf("--tcp-established cannot be used with --name")
|
return errors.Errorf("--tcp-established cannot be used with --name")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.Import != "") && (c.All || c.Latest) {
|
argLen := len(c.InputArgs)
|
||||||
return errors.Errorf("Cannot use --import and --all or --latest at the same time")
|
if c.Import != "" {
|
||||||
|
if c.All || c.Latest {
|
||||||
|
return errors.Errorf("Cannot use --import with --all or --latest")
|
||||||
|
}
|
||||||
|
if argLen > 0 {
|
||||||
|
return errors.Errorf("Cannot use --import with positional arguments")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
argLen := len(c.InputArgs)
|
|
||||||
if (c.All || c.Latest) && argLen > 0 {
|
if (c.All || c.Latest) && argLen > 0 {
|
||||||
return errors.Errorf("no arguments are needed with --all or --latest")
|
return errors.Errorf("no arguments are needed with --all or --latest")
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,8 @@ connections.
|
||||||
**--import, -i**
|
**--import, -i**
|
||||||
|
|
||||||
Import a checkpoint tar.gz file, which was exported by Podman. This can be used
|
Import a checkpoint tar.gz file, which was exported by Podman. This can be used
|
||||||
to import a checkpointed container from another host. It is not necessary to specify
|
to import a checkpointed container from another host. Do not specify a *container*
|
||||||
a container when restoring from an exported checkpoint.
|
argument when using this option.
|
||||||
|
|
||||||
**--name, -n**
|
**--name, -n**
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue