aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/kubectx
blob: ac99869f6d416c4fa8a77b36c80534f9d6326c5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /usr/bin/env perl6

#| Show all available contexts.
multi sub MAIN ()
{
	run << kubectl config get-contexts >>;
}

#| Switch to a given context.
multi sub MAIN (
	#| The name of the context to switch to.
	Str:D $context,
) {
	run << kubectl config use-context "$context" >>;
}

#| Switch to a given namespace in a given context.
multi sub MAIN (
	#| The name of the context to switch to.
	Str:D $context,

	#| The name of the namespace to switch to.
	Str:D $namespace,
) {
	samewith($context);
	run << kubectl config set-context --current "--namespace=$namespace" >>;
}