Skip to content

Commit

Permalink
Renamed tmux exec to tmux-exec
Browse files Browse the repository at this point in the history
  • Loading branch information
predatorray committed Mar 3, 2020
1 parent 1a66305 commit 232bda9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME=kubectl-tmux-exec
VERSION=0.0.1
VERSION=0.0.2

OUTPUT_DIR=output
RELEASE_FILE_NAME=$(NAME)-$(VERSION).tar.gz
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Instead of `exec bash` into multiple pod's containers one-at-a-time, like `kubec
You can now use

```sh
kubectl tmux exec -it -l app=nginx /bin/bash
kubectl tmux-exec -it -l app=nginx /bin/bash
```

# Installation via Homebrew
Expand All @@ -22,11 +22,11 @@ After that, execute the command below.
brew install predatorray/brew/kubectl-tmux-exec
```

The script should be installed under `/usr/local/bin/kubectl-tmux-exec` by default. Please ensure the `bin` directory is in your `$PATH` environment variable.
The script should be installed under `/usr/local/bin/kubectl-tmux_exec` by default. Please ensure the `bin` directory is in your `$PATH` environment variable.

# Usage

To execute this script as a [plugin]((https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/)), a `kubectl` version prior to `1.12.0` is required and the latest version is preferred. But you can execute the script directly like `kubectl-tmux-exec [...ARGS]` if it is not supported.
To execute this script as a [plugin]((https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/)), a `kubectl` version prior to `1.12.0` is required and the latest version is preferred. But you can execute the script directly like `kubectl-tmux_exec [...ARGS]` if it is not supported.

If it is supported, you can check if the script has been added to kubectl's plugin list by

Expand All @@ -39,31 +39,31 @@ The output should be like
```txt
The following compatible plugins are available:
/usr/local/bin/kubectl-tmux-exec
/usr/local/bin/kubectl-tmux_exec
```

If it does not show in the list, check `$PATH` env again.

You can use the command below to get the usage of the script.

```sh
kubectl tmux exec --help
kubectl tmux-exec --help
```

Or, execute it directly.

```
kubectl-tmux-exec --help
kubectl-tmux_exec --help
```

## Example

The `tmux exec` is similar to `exec`, except that it requires label selectors while `exec` requires a pod name.
The `tmux-exec` is similar to `exec`, except that it requires label selectors while `exec` requires a pod name.

To `bash` into all pod containers that share some common labels, `foo=bar` for instance.

```sh
kubectl tmux exec -it -l foo=bar /bin/bash
kubectl tmux-exec -it -l foo=bar /bin/bash
```

It should be noted that the `-i` / `--stdin` and `-t` / `--tty` options must both be turned on when you are trying to initiate an interactive session. If not, there will not be any errors. Instead, the `tmux` process simply exits because the `exec`-ed command exits due to no inputs.
Expand Down
3 changes: 2 additions & 1 deletion bin/kubectl-tmux-exec → bin/kubectl-tmux_exec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

set -euf -o pipefail

readonly PROG_NAME='kubectl tmux exec'
readonly PROG_NAME='kubectl tmux-exec'

declare -ra KUBECTL_SHORT_OPTS=(
'n'
Expand All @@ -39,6 +39,7 @@ declare -ra KUBECTL_LONG_OPTS=(
'token'
'user'
'username'
'kubeconfig'
)

declare -ra KUBECTL_NOARG_LONG_OPTS=(
Expand Down

0 comments on commit 232bda9

Please sign in to comment.