You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/env -S vimportosimportflagfnmain() {
mutfp:= flag.new_flag_parser(os.args)
fp.application('flag_parser_example')
fp.version('0.0.1')
fp.description('Example V shell script')
fp.skip_executable()
file_path:= fp.string('path', `p`, '', 'The path to the file to read')
fp.finalize()!println('File path: ${file_path}')
}
Saving the script as flag_parser_example.vsh and running it with ./flag_parser_example.sh --path /etc/bash.bashrc or any other existing file path does not execute the script as expected but gives the message Too many targets. Specify just one target: <target.v|target_directory>..
Reproduction Steps
Save the above script
Run it with ./<script_name>.vsh --path <existing file path>
You will see the script is not executed but instead the message Too many targets. Specify just one target: <target.v|target_directory>. appears.
Expected Behavior
The script should print File path: /etc/bash.bashrc if it was called with --path /etc/bash.bashrc.
It behaves as expected for any random string or any string formatted like a file pointing to a non-existent file path, e.g. ./flag_parser_example.vsh --path /etc/bash.nonexistent prints File path: /etc/bash.nonexistent as one would expect.
Current Behavior
Running the script wit --path <path to existing file> prints Too many targets. Specify just one target: <target.v|target_directory>. instead of running the script with the behaviour explained above.
Running v run flag_parser_example.vsh --path /etc/bash.bashrc behaves as expected and prints File path: /etc/bash.bashrc.
Possible Solution
No response
Additional Information/Context
This behaviour prevents from writing useful scripts in V instead of Bash as it is very often necessary to have file paths to existing files as input.
V version
V 0.4.3 e1a474e
Environment details (OS name and version, etc.)
V full version: V 0.4.3 e1a474e
OS: linux, Ubuntu 20.04.6 LTS (WSL 2)
Processor: 12 cpus, 64bit, little endian, Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Describe the bug
Code: https://gist.github.com/PetFeld/92a83032db14a080ae8a2fa419660d91
Saving the script as
flag_parser_example.vsh
and running it with./flag_parser_example.sh --path /etc/bash.bashrc
or any other existing file path does not execute the script as expected but gives the messageToo many targets. Specify just one target: <target.v|target_directory>.
.Reproduction Steps
./<script_name>.vsh --path <existing file path>
You will see the script is not executed but instead the message
Too many targets. Specify just one target: <target.v|target_directory>.
appears.Expected Behavior
The script should print
File path: /etc/bash.bashrc
if it was called with--path /etc/bash.bashrc
.It behaves as expected for any random string or any string formatted like a file pointing to a non-existent file path, e.g.
./flag_parser_example.vsh --path /etc/bash.nonexistent
printsFile path: /etc/bash.nonexistent
as one would expect.Current Behavior
Running the script wit
--path <path to existing file>
printsToo many targets. Specify just one target: <target.v|target_directory>.
instead of running the script with the behaviour explained above.Running
v run flag_parser_example.vsh --path /etc/bash.bashrc
behaves as expected and printsFile path: /etc/bash.bashrc
.Possible Solution
No response
Additional Information/Context
This behaviour prevents from writing useful scripts in V instead of Bash as it is very often necessary to have file paths to existing files as input.
V version
V 0.4.3 e1a474e
Environment details (OS name and version, etc.)
V full version: V 0.4.3 e1a474e
OS: linux, Ubuntu 20.04.6 LTS (WSL 2)
Processor: 12 cpus, 64bit, little endian, Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
getwd: /home/tyr/projects/tests/v-cli
vexe: /home/tyr/v/v
vexe mtime: 2023-11-25 19:06:38
vroot: OK, value: /home/tyr/v
VMODULES: OK, value: /home/tyr/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.25.1
Git vroot status: weekly.2023.42-331-ge1a474e1
.git/config present: true
CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: