mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
feat: cmd to print debug information (#787)
This commit is contained in:
parent
d37e99a21e
commit
8ca2af3316
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -32,14 +32,13 @@ Tell us what happened instead
|
||||
|
||||
### Environment
|
||||
|
||||
**OS**:
|
||||
<!-- Copy the output of `asdf info` here -->
|
||||
```shell
|
||||
|
||||
**asdf version**:
|
||||
```
|
||||
|
||||
**asdf plugins affected (if relevant)**:
|
||||
|
||||
**asdf plugins installed**:
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
|
@ -30,6 +30,7 @@ asdf_commands=( # 'asdf help' lists commands with help text
|
||||
# utils
|
||||
'exec:executes the command shim for the current version'
|
||||
'env:prints or runs an executable under a command environment'
|
||||
'info:print os, shell and asdf debug information'
|
||||
'reshim:recreate shims for version of a package'
|
||||
'shim:shim management sub-commands'
|
||||
'shim-versions:list for given command which plugins and versions provide it'
|
||||
|
@ -56,7 +56,7 @@ _asdf() {
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
local cmds='current global help install list list-all local plugin-add plugin-list plugin-list-all plugin-remove plugin-update reshim shell uninstall update where which '
|
||||
local cmds='current global help install list list-all local plugin-add plugin-list plugin-list-all plugin-remove plugin-update reshim shell uninstall update where which info'
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
||||
;;
|
||||
|
@ -132,4 +132,5 @@ complete -f -c asdf -n '__fish_asdf_using_command shell; and test (count (comman
|
||||
|
||||
# misc
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -l "help" -d "Displays help"
|
||||
complete -f -c asdf -m '__fish_asdf_needs_command' -l "info" -d "Print OS, Shell and ASDF debug information"
|
||||
complete -f -c asdf -n '__fish_asdf_needs_command' -l "version" -d "Displays asdf version"
|
||||
|
3
help.txt
3
help.txt
@ -14,7 +14,7 @@ asdf plugin update --all Update all plugins
|
||||
|
||||
MANAGE PACKAGES
|
||||
asdf install Install all the package versions listed
|
||||
in the .tool-versions file
|
||||
in the .tool-versions file
|
||||
asdf install <name> Install one tool at the version
|
||||
specified in the .tool-versions file
|
||||
asdf install <name> <version> Install a specific version of a package
|
||||
@ -45,6 +45,7 @@ UTILS
|
||||
asdf exec <command> [args...] Executes the command shim for current version
|
||||
asdf env <command> [util] Runs util (default: `env`) inside the
|
||||
environment used for command shim execution.
|
||||
asdf info Print OS, Shell and ASDF debug information.
|
||||
asdf reshim <name> <version> Recreate shims for version of a package
|
||||
asdf shim-versions <command> List the plugins and versions that
|
||||
provide a command
|
||||
|
11
lib/commands/command-info.bash
Normal file
11
lib/commands/command-info.bash
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- sh -*-
|
||||
|
||||
info_command() {
|
||||
printf "%s:\n%s\n\n" "OS" "$(uname -a)"
|
||||
printf "%s:\n%s\n\n" "SHELL" "$($SHELL --version)"
|
||||
printf "%s:\n%s\n\n" "ASDF VERSION" "$(asdf_version)"
|
||||
printf "%s:\n%s\n\n" "ASDF ENVIRONMENT VARIABLES" "$(env | grep -E "ASDF_DIR|ASDF_DATA_DIR|ASDF_CONFIG_FILE|ASDF_DEFAULT_TOOL_VERSIONS_FILENAME")"
|
||||
printf "%s:\n%s\n\n" "ASDF INSTALLED PLUGINS" "$(asdf plugin list --urls)"
|
||||
}
|
||||
|
||||
info_command "$@"
|
27
test/info_command.bats
Normal file
27
test/info_command.bats
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helpers
|
||||
|
||||
setup() {
|
||||
setup_asdf_dir
|
||||
install_dummy_plugin
|
||||
install_dummy_legacy_plugin
|
||||
run asdf install dummy 1.0
|
||||
run asdf install dummy 1.1
|
||||
|
||||
PROJECT_DIR=$HOME/project
|
||||
mkdir $PROJECT_DIR
|
||||
}
|
||||
|
||||
teardown() {
|
||||
clean_asdf_dir
|
||||
}
|
||||
|
||||
@test "info should show os, shell and asdf debug information" {
|
||||
cd $PROJECT_DIR
|
||||
|
||||
run asdf info
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
# TODO: Assert asdf info output is printed
|
||||
}
|
Loading…
Reference in New Issue
Block a user