Merge branch 'master' into improve-pwd

This commit is contained in:
Trevor Brown 2023-01-04 09:49:11 -05:00 committed by GitHub
commit 8aa060ade9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 149 additions and 17 deletions

View File

@ -1,4 +1,3 @@
bats 1.7.0
shellcheck 0.8.0
shfmt 3.5.1
python 3.10.9
bats 1.8.2
shellcheck 0.9.0
shfmt 3.6.0

View File

@ -31,7 +31,7 @@ See [CONTRIBUTING.md in the repo](https://github.com/asdf-vm/asdf/blob/master/CO
## Community & Questions
- [FAQ](https://asdf-vm.com/learn-more/faq.html)
- [FAQ](https://asdf-vm.com/more/faq.html)
- [![GitHub Issues](https://icongr.am/simple/github.svg?color=808080&size=16) GitHub Issues](https://github.com/asdf-vm/asdf/issues): report a bug or raise a feature request to the `asdf` core team
- [![StackOverflow Tag](https://icongr.am/fontawesome/stack-overflow.svg?size=16&color=808080) StackOverflow Tag](https://stackoverflow.com/questions/tagged/asdf-vm): see existing Q&A for `asdf`. Some of the core team watch this tag in addition to our helpful community

View File

@ -84,6 +84,22 @@ Completions must be configured manually with the following entry in your `.bash_
:::
::: details Bash & Homebrew
Add `asdf.sh` to your `~/.bashrc` with:
```shell:no-line-numbers
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.bashrc
```
Completions will need to be [configured as per Homebrew's instructions](https://docs.brew.sh/Shell-Completion#configuring-completions-in-bash) or with the following:
```shell:no-line-numbers
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.bashrc
```
:::
::: details Bash & Homebrew (macOS)
If using **macOS Catalina or newer**, the default shell has changed to **ZSH**. Unless changing back to Bash, follow the ZSH instructions.

View File

@ -124,6 +124,31 @@ rm -rf $HOME/.tool-versions $HOME/.asdfrc
:::
::: details Bash & Homebrew
1. In your `~/.bashrc` remove the lines that source `asdf.sh` and the completions:
```shell
. $(brew --prefix asdf)/libexec/asdf.sh
. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
```
Completions may have been [configured as per Homebrew's instructions](https://docs.brew.sh/Shell-Completion#configuring-completions-in-bash) so follow their guide to find out what to remove.
2. Uninstall with your package manager:
```shell:no-line-numbers
brew uninstall asdf --force
```
3. Run this command to remove all `asdf` config files:
```shell:no-line-numbers
rm -rf $HOME/.tool-versions $HOME/.asdfrc
```
:::
::: details Bash & Homebrew (macOS)
If using **macOS Catalina or newer**, the default shell has changed to **ZSH**. If you can't find any config in your `~/.bash_profile` it may be in a `~/.zshrc` in which case please follow the ZSH instructions.

View File

@ -10,7 +10,7 @@ Here are some community projects related to `asdf`:
::: warning Note
asdf core do not own these projects or their code. asdf core are not responsible
asdf core team do not own these projects or their code. asdf core are not responsible
for the quality or security as they relate to those listed here.
:::

View File

@ -79,6 +79,22 @@ O auto completar deve ser configurado manualmente a partir da adição da seguin
:::
::: details Bash & Homebrew
Adicione `asdf.sh` ao `~/.bashrc` através do comando:
```shell:no-line-numbers
echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.bashrc
```
O auto completar deve ser configurado seguindo as [instruções da Homebrew](https://docs.brew.sh/Shell-Completion#configuring-completions-in-bash), ou as seguintes:
```shell:no-line-numbers
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.bashrc
```
:::
::: details Bash & Homebrew (macOS)
Se você estiver usando o **macOS Catalina ou mais recente**, o shell padrão mudou para o **ZSH**. A não ser que você tenha voltado para o bash, siga as instruções de instalação para o ZSH.

View File

@ -126,6 +126,31 @@ rm -rf $HOME/.tool-versions $HOME/.asdfrc
:::
::: details Bash & Homebrew
1. Em seu `~/.bashrc` remova as linhas do `asdf.sh` e remova seus complementos:
```shell
. $(brew --prefix asdf)/libexec/asdf.sh
. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
```
?> Os complementos precisam [instruções de configuração do Homebrew](https://docs.brew.sh/Shell-Completion#configuring-completions-in-bash) e siga o guia de remoção.
2. Desinstale usando seu gerenciador de pacotes:
```shell
brew uninstall asdf --force
```
3. Execute o comando para remover todos os arquivos de configurações do `asdf`:
```shell
rm -rf $HOME/.tool-versions $HOME/.asdfrc
```
:::
::: details Bash & Homebrew (macOS)
Caso esteja usando **macOs Catalina ou mais recente**, por padrão o _shell_ é **ZSH**. Se não achar alguma configuração em seu `~/.bash_profile` talvez esteja em `~/.zshrc` em cada caso siga as intruções do ZSH.

View File

@ -79,6 +79,22 @@
:::
::: details Bash & Homebrew
使用以下命令将 `asdf.sh` 加入到 `~/.bashrc` 文件中:
```shell:no-line-numbers
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.bashrc
```
补全功能将需要 [按照 Homebrew 的说明完成配置](https://docs.brew.sh/Shell-Completion#configuring-completions-in-bash) 或者执行以下命令:
```shell:no-line-numbers
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.bashrc
```
:::
::: details Bash & Homebrew (macOS)
如果你正在使用 **macOS Catalina 或者更新的版本**, 默认的 shell 已经被修改为 **ZSH**。除非修改回 Bash, 否则请遵循 ZSH 的说明。

View File

@ -124,6 +124,31 @@ rm -rf $HOME/.tool-versions $HOME/.asdfrc
:::
::: details Bash & Homebrew
1. 在 `~/.bashrc` 配置文件中移除生效 `asdf.sh` 和补全功能的行:
```shell
. $(brew --prefix asdf)/libexec/asdf.sh
. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
```
补全功能可能已经如 [Homebrew 的指南](https://docs.brew.sh/Shell-Completion#configuring-completions-in-bash) 那样配置了,因此请按照他们的指南找出要删除的内容。
2. 用包管理器卸载:
```shell:no-line-numbers
brew uninstall asdf --force
```
3. 执行以下命令移除 `asdf` 所有配置文件:
```shell:no-line-numbers
rm -rf $HOME/.tool-versions $HOME/.asdfrc
```
:::
::: details Bash & Homebrew (macOS)
如果你正在使用 **macOS Catalina 以及更新版本**,默认的 shell 已经变成了 **ZSH**。如果你在 `~/.bash_profile` 文件中找不到任何配置,则可能位于 `~/.zshrc` 中。在这种情况下,请按照 ZSH 指南进行操作。

View File

@ -150,7 +150,7 @@ plugin_test_command() {
"$@"
exit_code=$?
if [ $exit_code != 0 ]; then
fail_test "$* failed with exit code $?"
fail_test "$* failed with exit code $exit_code"
fi
fi

View File

@ -56,9 +56,9 @@ plugin_add_command() {
local plugin_name=$1
local regex="^[[:alpha:][:digit:]_-]+$"
local regex="^[[:lower:][:digit:]_-]+$"
if ! printf "%s" "$plugin_name" | grep -q -E "$regex"; then
display_error "$plugin_name is invalid. Name must match regex $regex"
display_error "$plugin_name is invalid. Name may only contain lowercase letters, numbers, '_', and '-'"
exit 1
fi

View File

@ -765,7 +765,9 @@ with_shim_executable() {
IFS=' ' read -r plugin_name full_version <<<"$selected_version"
plugin_path=$(get_plugin_path "$plugin_name")
run_within_env() {
# This function does get invoked, but shellcheck sees it as unused code
# shellcheck disable=SC2317
function run_within_env() {
local path
path=$(remove_path_from_path "$PATH" "$(asdf_data_dir)/shims")

1
scripts/.tool-versions Normal file
View File

@ -0,0 +1 @@
python 3.11.1

0
scripts/checkstyle.py Executable file → Normal file
View File

View File

@ -11,13 +11,13 @@ teardown() {
}
@test "plugin_add command with plugin name matching all valid regex chars succeeds" {
install_mock_plugin_repo "plugin_with-all-valid-CHARS-123"
install_mock_plugin_repo "plugin_with-all-valid-chars-123"
run asdf plugin add "plugin_with-all-valid-CHARS-123" "${BASE_DIR}/repo-plugin_with-all-valid-CHARS-123"
run asdf plugin add "plugin_with-all-valid-chars-123" "${BASE_DIR}/repo-plugin_with-all-valid-chars-123"
[ "$status" -eq 0 ]
run asdf plugin list
[ "$output" = "plugin_with-all-valid-CHARS-123" ]
[ "$output" = "plugin_with-all-valid-chars-123" ]
}
@test "plugin_add command with LANG=sv_SE.UTF-8 and plugin name matching all valid regex chars succeeds" {
@ -36,16 +36,23 @@ teardown() {
LANG="$ORIGINAL_LANG"
}
@test "plugin_add command with plugin name not matching valid regex fails" {
@test "plugin_add command with plugin name not matching valid regex fails 1" {
run asdf plugin add "invalid\$plugin\$name"
[ "$status" -eq 1 ]
[ "$output" = "invalid\$plugin\$name is invalid. Name must match regex ^[[:alpha:][:digit:]_-]+$" ]
[ "$output" = "invalid\$plugin\$name is invalid. Name may only contain lowercase letters, numbers, '_', and '-'" ]
}
@test "plugin_add command with plugin name not matching valid regex fails again" {
@test "plugin_add command with plugin name not matching valid regex fails 2" {
run asdf plugin add "#invalid#plugin#name"
[ "$status" -eq 1 ]
[ "$output" = "#invalid#plugin#name is invalid. Name must match regex ^[[:alpha:][:digit:]_-]+$" ]
[ "$output" = "#invalid#plugin#name is invalid. Name may only contain lowercase letters, numbers, '_', and '-'" ]
}
@test "plugin_add command with plugin name not matching valid regex fails 3" {
run asdf plugin add "Ruby"
[ "$status" -eq 1 ]
[ "$output" = "Ruby is invalid. Name may only contain lowercase letters, numbers, '_', and '-'" ]
}
@test "plugin_add command with no URL specified adds a plugin using repo" {