asdf-vm / asdf-vm/asdf

bug: The "asdf version" command should not allow additional parameters and report them as an error

Open
#1,674 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
25.6k
Forks
941
Avg merge
9h 24m
Merged PRs (30d)
3

Description

### Describe the Bug

If you run `asdf version python` (which I was mistakenly typing instead of `asdf list python`) you will get a version number which belongs to the ASDF tool itself not to the plugin.

So `asdf version` is basically ignoring any extra paramenter.

If you run `asdf version a b c d` it will still happily print the current ASDF version number.

### Steps to Reproduce

1. Type `asdf version a b c d`
2. Check that the current version of ASDF gets printed with any error message indicating that the command does not take any extra parameters.

### Expected Behaviour

If I type `asdf version python` or `asdf version something else` I should get a error message like the following:

```
The asdf version command does not take any extra parameter
```

### Actual Behaviour

Right now it will print the currently installed version of ASDF.

### Environment

```shell
OS:
Linux DESKTOP-PI97MVD 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

BASH VERSION:
5.1.16(1)-release

ASDF VERSION:
v0.13.1-0586b37

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/home/gnrfan/.asdf
ASDF_DIR=/home/gnrfan/.asdf
ASDF_CONFIG_FILE=/home/gnrfan/.asdfrc

ASDF INSTALLED PLUGINS:
crystal https://github.com/asdf-community/asdf-crystal.git master 6b5c52a
dart https://github.com/PatOConnor43/asdf-dart.git master 0ece407
deno https://github.com/asdf-community/asdf-deno.git master 87442fe
dmd https://github.com/sylph01/asdf-dmd.git master ec366a3
dotnet https://github.com/hensou/asdf-dotnet main be1cd7d
golang https://github.com/kennyp/asdf-golang.git master 21d9c32
lua https://github.com/Stratus3D/asdf-lua.git master 36fae6e
nodejs https://github.com/asdf-vm/asdf-nodejs.git master 4f8aa3d
python https://github.com/danhper/asdf-python.git master 8505457
ruby https://github.com/asdf-vm/asdf-ruby.git master c51c43f
rust https://github.com/code-lever/asdf-rust.git master 95acf4f
swift https://github.com/fcrespo82/asdf-swift.git master 23dbd46
zig https://github.com/cheetah/asdf-zig.git master d88f6db
```

### asdf plugins affected (if relevant)

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the CLI entry point for the `asdf version` command and trace how extra arguments are parsed; the issue does not name a source file or test. Done means `asdf version` still prints the ASDF version, while any additional arguments produce an error instead, with coverage for the reported examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.