Skip to content

Commit

Permalink
Implemented list option. Help expanded and improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
radraw committed Jul 31, 2023
1 parent 8fce4ae commit 0a8d7e4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions kubectl-switch_config
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@
#Author: Radoslaw Warowny
#License: GPL (General Public License) version 3

getopts h opt
getopts hl opt

if [ "$opt" = "h" ]; then
echo Usage:
echo "\t kubectl switch-config [-h] [-l] | [<name>]"
echo
echo 'Notice: You shoud have created configuration file in your $HOME/.kube directory named: config-name before.'
echo 'Notice: You shoud have created configuration file in your $HOME/.kube directory named: config-name before first use.'
echo
echo 'Options:'
echo ' -h show (this) help'
echo ' -l list available configuration names possible for switching'
echo
echo 'Invoking with no arguments shows current (lately selected) configuration'
exit
fi

if [ "$opt" = "l" ]; then
cd ~/.kube && ls -1 config-* | sed 's/^config-//'
exit
fi

Expand Down

0 comments on commit 0a8d7e4

Please sign in to comment.