mirror of
https://github.com/containers/podman.git
synced 2025-06-20 09:03:43 +08:00
cli: podman --module use StringArray()
This option accepts a file path so we should allow commas in it. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -72,7 +72,7 @@ func containersConfModules() ([]string, error) {
|
|||||||
fs.ParseErrorsWhitelist.UnknownFlags = true
|
fs.ParseErrorsWhitelist.UnknownFlags = true
|
||||||
fs.Usage = func() {}
|
fs.Usage = func() {}
|
||||||
fs.SetInterspersed(false)
|
fs.SetInterspersed(false)
|
||||||
fs.StringSliceVar(&modules, "module", nil, "")
|
fs.StringArrayVar(&modules, "module", nil, "")
|
||||||
fs.BoolP("help", "h", false, "") // Need a fake help flag to avoid the `pflag: help requested` error
|
fs.BoolP("help", "h", false, "") // Need a fake help flag to avoid the `pflag: help requested` error
|
||||||
return modules, fs.Parse(os.Args[index:])
|
return modules, fs.Parse(os.Args[index:])
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
|||||||
// as a flag here to a) make sure that rootflags are aware of
|
// as a flag here to a) make sure that rootflags are aware of
|
||||||
// this flag and b) to have shell completions.
|
// this flag and b) to have shell completions.
|
||||||
moduleFlagName := "module"
|
moduleFlagName := "module"
|
||||||
lFlags.StringSlice(moduleFlagName, nil, "Load the containers.conf(5) module")
|
lFlags.StringArray(moduleFlagName, nil, "Load the containers.conf(5) module")
|
||||||
_ = cmd.RegisterFlagCompletionFunc(moduleFlagName, common.AutocompleteContainersConfModules)
|
_ = cmd.RegisterFlagCompletionFunc(moduleFlagName, common.AutocompleteContainersConfModules)
|
||||||
|
|
||||||
// A *hidden* flag to change the database backend.
|
// A *hidden* flag to change the database backend.
|
||||||
|
@ -104,8 +104,8 @@ See 'podman create --help'" "--module must be specified before the command"
|
|||||||
|
|
||||||
run_podman rm -f $cid
|
run_podman rm -f $cid
|
||||||
|
|
||||||
# Nonexistent module path
|
# Nonexistent module path with comma
|
||||||
nonesuch=${PODMAN_TMPDIR}/nonexistent
|
nonesuch=${PODMAN_TMPDIR}/nonexistent,withcomma
|
||||||
run_podman 1 --module=$nonesuch sdfsdfdsf
|
run_podman 1 --module=$nonesuch sdfsdfdsf
|
||||||
is "$output" "Failed to obtain podman configuration: could not resolve module \"$nonesuch\": stat $nonesuch: no such file or directory" \
|
is "$output" "Failed to obtain podman configuration: could not resolve module \"$nonesuch\": stat $nonesuch: no such file or directory" \
|
||||||
"--module=ENOENT"
|
"--module=ENOENT"
|
||||||
|
Reference in New Issue
Block a user