Skip to content

Commit 80a68a9

Browse files
Use StringArrayVarP for --include and --exclude flags (#196)
* Use StringArrayVarP for --include/--exclude Replace `StringSliceVarP` with `StringArrayVarP` for the --include and --exclude flags so regex strings can contain colons. * Update README.md Co-authored-by: Kazuki Suda <kazuki.suda@gmail.com>
1 parent f6e76ba commit 80a68a9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ The `pod` query is a regular expression so you could provide `"web-\w"` to tail
7070
`--container-state` | `running` | Tail containers with state in running, waiting or terminated. To specify multiple states, repeat this or set comma-separated value.
7171
`--context` | | Kubernetes context to use. Default to current context configured in kubeconfig.
7272
`--ephemeral-containers` | `true` | Include or exclude ephemeral containers.
73-
`--exclude`, `-e` | | Log lines to exclude. (regular expression)
73+
`--exclude`, `-e` | `[]` | Log lines to exclude. (regular expression)
7474
`--exclude-container`, `-E` | | Container name to exclude when multiple containers in pod. (regular expression)
7575
`--exclude-pod` | | Pod name to exclude. (regular expression)
7676
`--field-selector` | | Selector (field query) to filter on. If present, default to ".*" for the pod-query.
77-
`--include`, `-i` | | Log lines to include. (regular expression)
77+
`--include`, `-i` | `[]` | Log lines to include. (regular expression)
7878
`--init-containers` | `true` | Include or exclude init containers.
7979
`--kubeconfig` | | Path to kubeconfig file to use. Default to KUBECONFIG variable then ~/.kube/config path.
8080
`--namespace`, `-n` | | Kubernetes namespace to use. Default to namespace configured in kubernetes context. To specify multiple namespaces, repeat this or set comma-separated value.

cmd/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,10 @@ func (o *options) AddFlags(fs *pflag.FlagSet) {
325325
fs.StringVarP(&o.container, "container", "c", o.container, "Container name when multiple containers in pod. (regular expression)")
326326
fs.StringSliceVar(&o.containerStates, "container-state", o.containerStates, "Tail containers with state in running, waiting or terminated. To specify multiple states, repeat this or set comma-separated value.")
327327
fs.StringVar(&o.context, "context", o.context, "Kubernetes context to use. Default to current context configured in kubeconfig.")
328-
fs.StringSliceVarP(&o.exclude, "exclude", "e", o.exclude, "Log lines to exclude. (regular expression)")
328+
fs.StringArrayVarP(&o.exclude, "exclude", "e", o.exclude, "Log lines to exclude. (regular expression)")
329329
fs.StringVarP(&o.excludeContainer, "exclude-container", "E", o.excludeContainer, "Container name to exclude when multiple containers in pod. (regular expression)")
330330
fs.StringVar(&o.excludePod, "exclude-pod", o.excludePod, "Pod name to exclude. (regular expression)")
331-
fs.StringSliceVarP(&o.include, "include", "i", o.include, "Log lines to include. (regular expression)")
331+
fs.StringArrayVarP(&o.include, "include", "i", o.include, "Log lines to include. (regular expression)")
332332
fs.BoolVar(&o.initContainers, "init-containers", o.initContainers, "Include or exclude init containers.")
333333
fs.BoolVar(&o.ephemeralContainers, "ephemeral-containers", o.ephemeralContainers, "Include or exclude ephemeral containers.")
334334
fs.StringVar(&o.kubeConfig, "kubeconfig", o.kubeConfig, "Path to kubeconfig file to use. Default to KUBECONFIG variable then ~/.kube/config path.")

0 commit comments

Comments
 (0)