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
Is your feature request related to a problem? Please describe.
When command line arguments are passed to a Bash script, the $@ array contains only the arguments:
hwalters@Ghostwheel ~/git/amber (improve-command-line-interface)
$ cat args.sh
#!/usr/bin/env bash
for arg in "$@"; do
echo $arg
done
hwalters@Ghostwheel ~/git/amber (improve-command-line-interface)
$ ./args.sh 1 2 3
1
2
3
However, when command line arguments are passed to an Amber script, the array passed to the main block contains the executable name bash as well. Note, this requires changes on my feature branch to pass command line arguments, as described in issue #411:
This is inconsistent, and will cause confusion among users. Additionally, we get no extra information from the contents of the $0 variable, as it will only ever contain bash.
Describe the solution you'd like
I would like the Amber script to be passed the command line arguments only, for consistency with Bash scripts.
I would also like to add a standard library function to partition the command line arguments into positional parameters and options (starting - or --):
Is your feature request related to a problem? Please describe.
When command line arguments are passed to a Bash script, the
$@
array contains only the arguments:However, when command line arguments are passed to an Amber script, the array passed to the
main
block contains the executable namebash
as well. Note, this requires changes on my feature branch to pass command line arguments, as described in issue #411:This is inconsistent, and will cause confusion among users. Additionally, we get no extra information from the contents of the
$0
variable, as it will only ever containbash
.Describe the solution you'd like
I would like the Amber script to be passed the command line arguments only, for consistency with Bash scripts.
I would also like to add a standard library function to partition the command line arguments into positional parameters and options (starting
-
or--
):Describe alternatives you've considered
N/A
Additional context
This is occurring because the
main
block is explicitly passed$0
as well as$@
:The text was updated successfully, but these errors were encountered: