Commit Graph

9 Commits

Author SHA1 Message Date
iwilltry42
9aa5af8d5d improve log level usage 2019-10-02 19:06:36 +02:00
iwilltry42
6a46ef9d94 fix prompt from env 2019-05-31 12:00:00 +02:00
iwilltry42
f220f0121a get prompt from env depdending on selected shell 2019-05-31 10:52:48 +02:00
iwilltry42
93115400fc add shell struct with prompt differentiation 2019-05-31 09:43:45 +02:00
iwilltry42
eb5b88052e add auto mode for shell based on SHELL env var and support zsh 2019-05-29 09:14:36 +02:00
Andy Zhou
8aaf70f4bf Block recursive bash invocation
In theory, we can execute 'k3d bash' again within an cluster shell. I
can't think of any practical value for allowing this capability.
On the contrary, this can lead to confusion to the user.

This patch adds a simple mechanism to detect and block recursive bash
invocation.
2019-05-24 17:16:12 -07:00
Andy Zhou
2971dd6845 Add the ability to execute commands directly with the bash subcommand
In addition to provide an interactive shell, this patch adds the
'--command' and '-c' options to allow user to issue a command in the
context of a cluster.

For example:

$ k3d bash -c 'kubectl cluster-info'
2019-05-24 17:16:12 -07:00
Andy Zhou
5c6f2d7dc5 Avoid hard coding the bash path
OS distribution and user may choose to install bash in different path.
This patch uses bash found by "$PATH" environment, rather than hard code
the bash path.

This patch also handle the case 'bash' are not found. Mostly likely due
to bash not being supported by the platform, or it is not installed.
2019-05-24 17:16:12 -07:00
Andy Zhou
4ef6710e22 Add basic bashShell() function
Add the basic frame work for supporting spawning a bash shell by cli
command.

With this change, we can spawn a bash shell in the context of a cluster

$ k3d create -n my-cluster
$ k3d bash -n my-cluster
[my-cluster] $>

// execute commands with KUBECONFIG already set up
[my-cluster] $> kubectl get pods
2019-05-24 17:16:12 -07:00