Skip to content

Commit

Permalink
Develop+0.0.1 (#75)
Browse files Browse the repository at this point in the history
* Refactoring followed by shellcheck

* Fix if negative condition

* Refactoring

* Bugfix (Github Issue #74)

* Use [[ instead of [ for the conditional statement

* Change from $VAR to ${VAR}

* Refactoring

* Add travis specific settings to test.sh

* Update .travis.yml

* [skip ci] Update man pages

* Add shellcheck to .travis.yml

* Fix .travis.yml

* Revert .travis.yml

* Improve .travis.yml

* Refactoring test code

* test code and .travis.yml works.

* [skip ci] Improve spelling and grammer

* [skip ci] Add install.sh

* Update test.sh

* [skip ci] Make install.sh executable

* [skip ci] Add uninstall.sh

* [skip ci] Set logs to (un)install.sh

* [skip ci] Fix
  • Loading branch information
greymd authored Jan 8, 2018
1 parent 0ef8ef7 commit 0bb9d8e
Show file tree
Hide file tree
Showing 10 changed files with 471 additions and 398 deletions.
51 changes: 15 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
language: generic
dist: precise
language: bash
sudo: required
addons:
apt:
packages:
- shellcheck
- ncurses-dev
- libevent-dev
- gcc
- make
- curl

branches:
only:
Expand Down Expand Up @@ -156,8 +164,6 @@ matrix:
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.5
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.6
- os: linux
env: SH=bash SH_VERSION=default TMUX_VERSION=0.8
- os: linux
env: SH=bash SH_VERSION=default TMUX_VERSION=0.9
- os: linux
Expand All @@ -172,43 +178,16 @@ matrix:
env: SH=bash SH_VERSION=default TMUX_VERSION=1.4
- os: linux
env: SH=bash SH_VERSION=default TMUX_VERSION=1.5
# -------------------------
# Skip tests (macOS on Travis does not have tty).
# -------------------------
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=1.6
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=1.7
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=1.8
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=1.9
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=1.9a
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=2.0
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=2.1
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=2.2
# - os: osx
# env: SH=bash SH_VERSION=default TMUX_VERSION=2.3

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] ;then sudo apt-get -qq update && sudo apt-get install -y ncurses-dev libevent-dev gcc make curl ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TMUX_VERSION" == "default" && ! $(which tmux) ]] ; then sudo apt-get install -y tmux ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$SH_VERSION" == "default" && ! $(which $SH) ]] ;then sudo apt-get install -y $SH ;fi
# - if [[ "$TRAVIS_OS_NAME" == "osx" ]] ;then brew update ;fi
# - if [[ "$TRAVIS_OS_NAME" == "osx" && "$TMUX_VERSION" == "default" && ! $(which tmux) ]] ; then brew install tmux ;fi
# - if [[ "$TRAVIS_OS_NAME" == "osx" && "$SH_VERSION" == "default" && ! $(which $SH) ]] ;then brew install $SH ;fi

before_script:
- export TMPDIR=$TRAVIS_BUILD_DIR/tmp
- mkdir -p $TMPDIR
- if [[ "$TMUX_VERSION" != "default" ]] ;then ( cd "$TMPDIR" && curl -L "https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz" | tar zxv && cd tmux-${TMUX_VERSION} && ./configure; make && sudo make install ) ;fi # tmux 0.8 does not require ./configure
# Remove default tmux
- if which tmux ;then sudo mv -f `which tmux` `which tmux`.bak ;fi
- ( cd "$TMPDIR" && curl -L "https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz" | tar zxv && cd tmux-${TMUX_VERSION} && ./configure --prefix=${TMPDIR}; make && sudo make install )
- if [[ "$SH" == "bash" && "$SH_VERSION" != "default" ]];then (cd "$TMPDIR" && curl "http://ftp.gnu.org/gnu/bash/bash-${SH_VERSION}.tar.gz" | tar xvz && cd bash* && ./configure; make && sudo make install && sudo mv /bin/bash /bin/bash.old && sudo cp ./bash /bin/bash ) ;fi
- if [[ "$SH" == "zsh" && "$SH_VERSION" != "default" ]];then (cd "$TMPDIR" && curl -L "https://sourceforge.net/projects/zsh/files/zsh/${SH_VERSION}/zsh-${SH_VERSION}.tar.gz/download" | tar zxv && cd zsh* && ./configure; make && sudo make install ) ;fi
- printf "set-window-option -g automatic-rename off\nset-option -g allow-rename off\n" >> "$HOME/.tmux.conf"

script:
- $SH ./test/test.sh
- shellcheck ./bin/xpanes
- TRAVIS_BUILD_DIR="${TRAVIS_BUILD_DIR}" $SH ./test/test.sh
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ $ sudo install -m 0755 xpanes /usr/local/bin/xpanes

# Usage

Two commands `xpanes` and `tmux-xpanes` will be installed. They are actually same commands (`tmux-xpanes` is alias of `xpanes`). Use one you like.
Two commands `xpanes` and `tmux-xpanes` will be installed. They are actually same commands (`tmux-xpanes` is alias of `xpanes`). Use whichever you like.

```
Usage:
Expand Down Expand Up @@ -229,7 +229,7 @@ As you can see, `{}` is replaced each arguments. This placeholder can be changed
$ xpanes -I@ -c 'seq @' 1 2 3 4
```

`echo {}` is used as the default placeholder when no commands is specified by `-c` option.
`echo {}` is used as the default placeholder when no command is specified by `-c` option.

[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) given by Bash or Zsh is very useful to generate sequential numbers or alphabetical characters.

Expand All @@ -240,7 +240,8 @@ $ xpanes {1..4}

## Behavior modes.

Basic usages are shown above. Before showing further usages, it is good to know about the conditional behavior of `xpanes` command.
It is good to know about the conditional behavior of `xpanes` command, before checking further usages.


### [Normal mode1] Outside of tmux session.

Expand All @@ -260,8 +261,8 @@ When the tmux is already open and `xpanes` command is executed from within the e

### [Pipe mode] Inside of tmux session & Accepting standard input.

When the tmux is open and `xpanes` command is executed from within tmux (which means Normal mode2).
In addition, when the command is accepting standard input ( the command followed by any other commands and pipe `|`), the command's behavior will be the special "Pipe mode".
When the tmux is open and `xpanes` command is executed from within tmux (Normal mode2)
and the command is accepting standard input ( the command followed by any other commands and pipe `|`), the command's behavior will be the special "Pipe mode".
It is documented in the [Pipe mode section](#pipe-mode).

## Further Examples
Expand Down Expand Up @@ -332,7 +333,7 @@ The result is like this.
+------------------------------------------+------------------------------------------+
```

Hmm? you want to monitor those files through the SSH? Just do it like this.
Hmm? Do you want to monitor those files through the SSH? Just do it like this.

```sh
# 'ssh user@host' is added.
Expand Down Expand Up @@ -622,7 +623,7 @@ When this command is executed on the tmux session, **it will create new window**
+-------------------------------+-------------------------------+
```

Same phenomenon will be occurred on upper right and bottom panes. The window which had three `xpanes` statements is closed itself. Finally, just the three windows will be left.
Same phenomenon will also be occurred on upper right and bottom panes. The window which had three `xpanes` statements is closed itself. Finally, just the three windows will be left.

## Pipe mode

Expand Down Expand Up @@ -723,6 +724,7 @@ $ echo test | xpanes -c 'echo {}' echo

### Connecting to multiple hosts given by `~/.ssh/config`

Pipe mode allows you to make combinations between tmux and other general UNIX commands.
For example, let's prepare `~/.ssh/config` file like this.

```text
Expand Down Expand Up @@ -781,13 +783,11 @@ The results would be like this.
+------------------------------+------------------------------+
```

Pipe mode allows you to make combinations between tmux and other general UNIX commands like this.

## Change default `tmux` command

Environment variable `TMUX_XPANES_EXEC` is preferentially used as a internal `tmux` command.
Pure `tmux` is used in case of empty.
Add the statement to your default login shell's configure file (i.e `.bashrc`, `.zshrc`) to change the environment variable .
`TMUX_XPANES_EXEC=tmux` is used by default.
Add the statement to your default login shell's configure file (i.e `.bashrc`, `.zshrc`) to change the environment variable.
It is helpful if you want to use specific tmux version, or enable specific options always.

```sh
Expand Down
2 changes: 1 addition & 1 deletion activate.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# Let PATH import 'xpanes' and 'tmux-xpanes' commands.
if ! (type xpanes > /dev/null 2>&1 &&
type tmux-xpanes > /dev/null 2>&1); then
__XPANES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-${(%):-%N}}")"; pwd)"
__XPANES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-${(%):-%N}}")" && pwd)"
export PATH="$PATH:$__XPANES_DIR/bin"
fi
Loading

0 comments on commit 0bb9d8e

Please sign in to comment.