Skip to content

Commit e8d6372

Browse files
authored
Merge branch 'master' into nu/completion
2 parents 8db4c60 + fa3d216 commit e8d6372

File tree

8 files changed

+48
-15
lines changed

8 files changed

+48
-15
lines changed

completions/asdf.bash

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _asdf() {
3939
COMPREPLY=($(compgen -W "$available_plugins" -- "$cur"))
4040
;;
4141
install | list | list-all | help)
42-
if [[ "$plugins" == *"$prev"* ]]; then
42+
if [[ " $plugins " == *" $prev "* ]]; then
4343
local versions
4444
versions=$(asdf list-all "$prev" 2>/dev/null)
4545
# shellcheck disable=SC2207
@@ -54,9 +54,10 @@ _asdf() {
5454
COMPREPLY=($(compgen -W "--head" -- "$cur"))
5555
;;
5656
uninstall | where | reshim)
57-
if [[ "$plugins" == *"$prev"* ]]; then
57+
if [[ " $plugins " == *" $prev "* ]]; then
5858
local versions
59-
versions=$(asdf list "$prev" 2>/dev/null)
59+
# The first two columns are either blank or contain the "current" marker.
60+
versions=$(asdf list "$prev" 2>/dev/null | colrm 1 2)
6061
# shellcheck disable=SC2207
6162
COMPREPLY=($(compgen -W "$versions" -- "$cur"))
6263
else
@@ -65,9 +66,10 @@ _asdf() {
6566
fi
6667
;;
6768
local | global | shell)
68-
if [[ "$plugins" == *"$prev"* ]]; then
69+
if [[ " $plugins " == *" $prev "* ]]; then
6970
local versions
70-
versions=$(asdf list "$prev" 2>/dev/null)
71+
# The first two columns are either blank or contain the "current" marker.
72+
versions=$(asdf list "$prev" 2>/dev/null | colrm 1 2)
7173
versions+=" system"
7274
# shellcheck disable=SC2207
7375
COMPREPLY=($(compgen -W "$versions" -- "$cur"))

docs/guide/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export ASDF_DIR="/opt/asdf-vm"
364364
`asdf` scripts need to be sourced **after** you have set your `$PATH` and **after** you have sourced your framework (oh-my-zsh etc).
365365

366366
::: warning
367-
On macOS, starting a Bash or Zsh shell automatically calls a utility called `path_helper`. `path_helper` can rearrange items in `PATH` (and `MANPATH`), causing inconsistent behavior for tools that require specific ordering. To workaround this, `asdf` on macOS defaults to forcily adding its `PATH`-entries to the front (taking highest priority). This is controllable with the `ASDF_FORCE_PREPEND` variable.
367+
On macOS, starting a Bash or Zsh shell automatically calls a utility called `path_helper`. `path_helper` can rearrange items in `PATH` (and `MANPATH`), causing inconsistent behavior for tools that require specific ordering. To workaround this, `asdf` on macOS defaults to forcibly adding its `PATH`-entries to the front (taking highest priority). This is controllable with the `ASDF_FORCE_PREPEND` variable.
368368
:::
369369

370370
Restart your shell so that `PATH` changes take effect. Opening a new terminal tab will usually do it.

docs/ja-jp/guide/getting-started.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## 1. 依存関係のインストール
1313

14-
asdfの動作には`git`および`curl`が必要です。以下の表は、 _あなたが使用している_ パッケージマネージャで実行するコマンドの _一部例_ です(some might automatically install these tools in later steps)。
14+
asdfの動作には`git`および`curl`が必要です。以下の表は、 _あなたが使用している_ パッケージマネージャで実行するコマンドの _一部例_ です(いくつかのツールは、後の手順で自動的にインストールされます)。
1515

1616
| OS | パッケージマネージャ | コマンド |
1717
| ----- | -------------------- | ---------------------------------- |
@@ -34,8 +34,9 @@ asdfの動作には`git`および`curl`が必要です。以下の表は、 _あ
3434

3535
<!-- x-release-please-start-version -->
3636

37+
3738
```shell
38-
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1
39+
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
3940

4041
```
4142

@@ -299,7 +300,7 @@ echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.ps1\"" >> ~/.config/powershell
299300
下記コマンドで、`~/.config/nushell/config.nu``asdf.nu`を追加します:
300301

301302
```shell
302-
"\n$env.ASDF_NU_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
303+
"\n$env.ASDF_DIR = ($env.HOME | path join '.asdf')\n source " + ($env.HOME | path join '.asdf/asdf.nu') | save --append $nu.config-path
303304
```
304305

305306
コマンド補完は自動的に設定されます。
@@ -310,7 +311,7 @@ echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.ps1\"" >> ~/.config/powershell
310311
下記コマンドで、`~/.config/nushell/config.nu``asdf.nu`を追加します:
311312

312313
```shell
313-
"\n$env.ASDF_NU_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
314+
"\n$env.ASDF_DIR = (brew --prefix asdf | str trim | into string | path join 'libexec')\n source " + (brew --prefix asdf | str trim | into string | path join 'libexec/asdf.nu') | save --append $nu.config-path
314315
```
315316

316317
コマンド補完は自動的に設定されます。
@@ -321,7 +322,7 @@ echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.ps1\"" >> ~/.config/powershell
321322
下記コマンドで、`~/.config/nushell/config.nu``asdf.nu`を追加します:
322323

323324
```shell
324-
"\n$env.ASDF_NU_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
325+
"\n$env.ASDF_DIR = '/opt/asdf-vm/'\n source /opt/asdf-vm/asdf.nu" | save --append $nu.config-path
325326
```
326327

327328
コマンド補完は自動的に設定されます。
@@ -363,7 +364,7 @@ export ASDF_DIR="/opt/asdf-vm"
363364
`asdf`のスクリプトは、`$PATH`を設定した**あと**、かつ、使用中のフレームワーク(oh-my-zsh など)を呼び出した**あと**に記述する必要があります。
364365

365366
::: warning 警告
366-
macOSでは、BasgまたはZSHシェルを起動すると、自動的に`path_helper`というユーティリティが呼び出されます。`path_helper``PATH`(および`MANPATH`)内の項目の順番を並び替えることができるため、特定の順序を必要とするツールの動作に、一貫性が無くなってしまいます。これを回避するため、macOSで`asdf`を利用するときは、強制的に`PATH`エントリの先頭に追加する(優先度を一番高くする)ようにしてください。これは、`ASDF_FORCE_PREPEND`環境変数で制御できます。
367+
macOSでは、BashまたはZSHシェルを起動すると、自動的に`path_helper`というユーティリティが呼び出されます。`path_helper``PATH`(および`MANPATH`)内の項目の順番を並び替えることができるため、特定の順序を必要とするツールの動作に、一貫性が無くなってしまいます。これを回避するため、macOSで`asdf`を利用するときは、強制的に`PATH`エントリの先頭に追加する(優先度を一番高くする)ようにしてください。これは、`ASDF_FORCE_PREPEND`環境変数で制御できます。
367368
:::
368369

369370
`PATH`の変更を反映するために、シェルを再起動してください。たいていの場合、ターミナルのタブを新たに開けばOKです。

docs/ja-jp/manage/configuration.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,31 @@ asdfプラグインのショートネームリポジトリの同期を無効化
152152

153153
備考: `ASDF_CONCURRENCY`環境変数が設定されている場合はそちらが優先されます。
154154

155+
### プラグインフック
156+
157+
下記のタイミングで、カスタムコードを実行することができます:
158+
159+
- プラグインのインストール、Shim再生成、更新および削除をする際の前後
160+
- プラグインコマンドの実行前後
161+
162+
例えば、`foo`というプラグインがインストールされていて、`bar`という実行可能ファイルが提供されている場合、以下のようなフックを使うことで、一番最初にカスタムコードを実行することができます:
163+
164+
```text
165+
pre_foo_bar = echo Executing with args: $@
166+
```
167+
168+
以下のパターンがサポートされています:
169+
170+
- `pre_<plugin_name>_<command>`
171+
- `pre_asdf_download_<plugin_name>`
172+
- `{pre,post}_asdf_{install,reshim,uninstall}_<plugin_name>`
173+
- `$1`: フルバージョン
174+
- `{pre,post}_asdf_plugin_{add,update,remove,reshim}`
175+
- `$1`: プラグイン名
176+
- `{pre,post}_asdf_plugin_{add,update,remove}_<plugin_name>`
177+
178+
どのようなコマンドの前後にどのようなコマンドフックを実行すべきかについての詳細は、[プラグインの作成](../plugins/create.md)をご覧ください。
179+
155180
## 環境変数
156181

157182
環境変数の設定値は、お使いのシステムやシェルによって異なります。デフォルトロケーションは、インストールした場所や方法(Gitクローン、Homebrew、AUR)によって異なります。

docs/ja-jp/plugins/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ asdf plugin test <plugin_name> <plugin_url> [--asdf-tool-version <version>] [--a
814814
デフォルトは、`asdf latest <plugin-name>`です。
815815
- オプションで`[--asdf-plugin-gitref <git_ref>]`を指定すると、
816816
そのコミット/ブランチ/タグでプラグイン自体をチェックアウトします。
817-
これは、プラグインのCIにおいて、プルリクエストをテストする際に便利です。
817+
これは、プラグインのCIにおいて、プルリクエストをテストする際に便利です。デフォルトは、プラグインリポジトリのデフォルトブランチとなります。
818818
- オプションの`[test_command...]`パラメータは、インストールしたツールが正しく動作するかを確認するために実行するコマンドです。
819819
通常は、`<tool> --version`または`<tool> --help`となります。
820820
例えば、NodeJSプラグインをテストするときは、次のように実行します:

docs/manage/versions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ asdf local <name> latest[:<version>]
8080

8181
`global` writes the version to `$HOME/.tool-versions`.
8282

83-
`shell` set the version to an environment variable named `ASDF_${TOOL}_VERSION`, for the current shell session only.
83+
`shell` sets the version to an environment variable named `ASDF_${TOOL}_VERSION`, for the current shell session only.
8484

8585
`local` writes the version to `$PWD/.tool-versions`, creating it if needed.
8686

lib/functions/installs.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ install_tool_version() {
243243
fi
244244
# Otherwise, remove the download directory if it exists
245245
elif [ -d "$download_path" ]; then
246-
rm -r "$download_path"
246+
rm -rf "$download_path"
247247
fi
248248

249249
reshim_command "$plugin_name" "$full_version"

test/setup_suite.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ setup_suite() {
33
# tests fail when it is set to something other than the temp dir.
44
unset ASDF_DIR
55

6+
# Also unset below variables, because in users shell shimmed commands
7+
# (include bats) export them by determining user's real HOME.
8+
unset ASDF_DATA_DIR
9+
unset ASDF_CONFIG_FILE
10+
611
# Set an agnostic Git configuration directory to prevent personal
712
# configuration from interfering with the tests
813
export GIT_CONFIG_GLOBAL=/dev/null

0 commit comments

Comments
 (0)