Skip to content

Commit 02b8503

Browse files
committed
Add --namespace to align with common k8s CLI flags
Closes boz#38.
1 parent ec131e2 commit 02b8503

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Flag | Selection
1616
--- | ---
1717
`-l, --label LABEL-SELECTOR` | match pods based on a [standard label selector](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)
1818
`-p, --pod NAME` | match pods by name
19-
`-n, --ns NAMESPACE-NAME` | match pods in the given namespace
19+
`-n, --ns, --namespace NAMESPACE-NAME` | match pods in the given namespace
2020
`--svc NAME` | match pods belonging to the given service
2121
`--rc NAME` | match pods belonging to the given replication controller
2222
`--rs NAME` | match pods belonging to the given replica set

Diff for: cmd/kail/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var (
3737
flagLabel = kingpin.Flag("label", "label").Short('l').PlaceHolder("SELECTOR").Strings()
3838
flagPod = kingpin.Flag("pod", "pod").Short('p').PlaceHolder("NAME").Strings()
3939
flagNs = kingpin.Flag("ns", "namespace").Short('n').PlaceHolder("NAME").Strings()
40+
flagNamespace = kingpin.Flag("namespace", "namespace (same as --ns)").PlaceHolder("NAME").Strings()
4041
flagIgnoreNs = kingpin.Flag("ignore-ns", "ignore namespace").PlaceHolder("NAME").Default("kube-system").Strings()
4142
flagSvc = kingpin.Flag("svc", "service").PlaceHolder("NAME").Strings()
4243
flagRc = kingpin.Flag("rc", "replication controller").PlaceHolder("NAME").Strings()
@@ -245,8 +246,11 @@ func createDSBuilder() kail.DSBuilder {
245246
dsb = dsb.WithNamespace(currentNS)
246247
}
247248

248-
if len(*flagNs) > 0 {
249-
dsb = dsb.WithNamespace(*flagNs...)
249+
if len(*flagNs) > 0 || len(*flagNamespace) > 0 {
250+
// Combine both namespace flags
251+
namespaces := append([]string{}, *flagNs...)
252+
namespaces = append(namespaces, *flagNamespace...)
253+
dsb = dsb.WithNamespace(namespaces...)
250254
}
251255

252256
if len(*flagIgnoreNs) > 0 {

0 commit comments

Comments
 (0)