Skip to content

Commit 571031f

Browse files
Merge pull request #27303 from goldlinker/main
chore: remove repetitive word in cmd/podman/README.md
2 parents 86eecc9 + b394fe1 commit 571031f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/podman/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The complete set can be found in the `validate` package, here are some examples:
112112

113113
## Adding CLI flags
114114

115-
When adding adding a new cli option that accepts a string array, there are two options to choose from: `StringSlice()` and `StringArray()`.
115+
When adding a new cli option that accepts a string array, there are two options to choose from: `StringSlice()` and `StringArray()`.
116116
They differ slightly in their behavior: `StringSlice()` allows the values to be comma separated so `--opt v1,v2 --opt v3` results in
117117
`[]string{"v1", "v2", "v3"}`, while `StringArray()` would result in `[]string{"v1,v2", "v3"}`. Thus it is impossible to use values with comma in `StringSlice()`, which makes it unsuitable for flags that accept arbitrary values such as file paths as example. Also, because `StringSlice()` uses the csv lib to parse the values, it has special escaping rules for things like quotes, see https://github.com/containers/podman/issues/20064 for an example of how complicated things can get because of this.
118118
Thus use `StringSlice()` only when the option accepts predefined values that do not contain special characters, for example `--cap-add` and `--cap-drop` are a good example for this. Using `--cap-add NET_ADMIN,NET_RAW` is equal to `--cap-add NET_ADMIN --cap-add NET_RAW` so it is better suited to save some typing for users.

0 commit comments

Comments
 (0)