Skip to content

Commit

Permalink
Merge pull request zplug#320 from 39e/add-zplug_bin
Browse files Browse the repository at this point in the history
Add environment variable
  • Loading branch information
b4b4r07 authored Feb 12, 2017
2 parents 9d9eed3 + 588798b commit 0b390bb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ $ZPLUG_HOME
`-- reponame1
```

If you specify `as:command`, zplug will see the package as a command and create a symbolic link of the same name (if you want to rename it, use the `rename-to:` tag) in `$ZPLUG_HOME/bin`. Because zplug adds `$ZPLUG_HOME/bin` to the `$PATH`, you can run that command from anywhere.
If you specify `as:command`, zplug will see the package as a command and create a symbolic link of the same name (if you want to rename it, use the `rename-to:` tag) in `$ZPLUG_BIN`. Because zplug adds `$ZPLUG_BIN` to the `$PATH`, you can run that command from anywhere.

#### `ZPLUG_THREADS`

Expand Down Expand Up @@ -356,6 +356,10 @@ source ~/.zshrc_secret
zplug "some/command", hook-build:"make && sudo make install"
```

#### `ZPLUG_BIN`

Defaults to `$ZPLUG_HOME/bin`. You can change the save destination of the command's symbolic link, e.g. `~/bin`.

### External commands

zplug, like `git(1)`, supports external commands.
Expand Down
2 changes: 1 addition & 1 deletion autoload/commands/__clean__
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ do
done

# Remove broken symlinks
__zplug::utils::shell::remove_deadlinks "$ZPLUG_HOME/bin"/*(@N)
__zplug::utils::shell::remove_deadlinks "$ZPLUG_BIN"/*(@N)

return $ret
6 changes: 4 additions & 2 deletions base/core/core.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ __zplug::core::core::prepare()
# Add to the PATH
path=(
${ZPLUG_ROOT:+"$ZPLUG_ROOT/bin"}
${ZPLUG_HOME:+"$ZPLUG_HOME/bin"}
${ZPLUG_BIN:+"$ZPLUG_BIN"}
"$path[@]"
)

Expand Down Expand Up @@ -144,7 +144,8 @@ __zplug::core::core::prepare()
# Release zplug variables and export
__zplug::core::core::variable || return 1

mkdir -p "$ZPLUG_HOME"/{,bin,log}
mkdir -p "$ZPLUG_HOME"/{,log}
mkdir -p "$ZPLUG_BIN"
mkdir -p "$ZPLUG_CACHE_DIR"
mkdir -p "$ZPLUG_REPOS"

Expand All @@ -171,6 +172,7 @@ __zplug::core::core::variable()

typeset -gx ZPLUG_ERROR_LOG=${ZPLUG_ERROR_LOG:-$ZPLUG_HOME/.error_log}

typeset -gx ZPLUG_BIN=${ZPLUG_BIN:-$ZPLUG_HOME/bin}
typeset -gx ZPLUG_CACHE_DIR=${ZPLUG_CACHE_DIR:-$ZPLUG_HOME/cache}
typeset -gx ZPLUG_REPOS=${ZPLUG_REPOS:-$ZPLUG_HOME/repos}

Expand Down
4 changes: 2 additions & 2 deletions base/sources/github.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ __zplug::sources::github::load_command()
if (( $#rename_hash == 0 )) && [[ -n $tags[rename-to] ]]; then
rename_hash=( $(__zplug::utils::shell::zglob \
"$tags[dir]/$tags[use]" \
"$ZPLUG_HOME/bin/$tags[rename-to]")
"$ZPLUG_BIN/$tags[rename-to]")
)
fi
else
Expand All @@ -244,7 +244,7 @@ __zplug::sources::github::load_command()
__zplug::utils::shell::expand_glob "$tags[dir]/$tags[use]" "(N-.)"
)"} )
fi
dst=${${tags[rename-to]:+$ZPLUG_HOME/bin/$tags[rename-to]}:-"$ZPLUG_HOME/bin"}
dst=${${tags[rename-to]:+$ZPLUG_BIN/$tags[rename-to]}:-"$ZPLUG_BIN"}
for src in "$sources[@]"
do
chmod 755 "$src"
Expand Down
6 changes: 5 additions & 1 deletion doc/guide/ja/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ $ZPLUG_HOME
`-- reponame1
```

`as:command` を指定したとき、zplug はパッケージをコマンドとみなし、同名のシンボリックリンクを `$ZPLUG_HOME/bin` に作成する (違う名前で作成したい場合、`rename-to:` タグを使う)。`$ZPLUG_HOME/bin``$PATH` に追加されるので、インストールしたコマンドはいつでもどこからでも実行可能になる。
`as:command` を指定したとき、zplug はパッケージをコマンドとみなし、同名のシンボリックリンクを `$ZPLUG_BIN` に作成する (違う名前で作成したい場合、`rename-to:` タグを使う)。`$ZPLUG_BIN``$PATH` に追加されるので、インストールしたコマンドはいつでもどこからでも実行可能になる。

#### `ZPLUG_THREADS`

Expand Down Expand Up @@ -354,6 +354,10 @@ source ~/.zshrc_secret
zplug "some/command", hook-build:"make && sudo make install"
```

#### `ZPLUG_BIN`

デフォルトは `$ZPLUG_HOME/bin`。コマンドのシンボリックリンクの保存先を変更することができる。例えば `~/bin` とか。

### 外部コマンド

zplug では `git(1)` のように外部コマンド機能が利用できる。
Expand Down

0 comments on commit 0b390bb

Please sign in to comment.