-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminate argument parsing on --
#10726
Conversation
encountering a -- terminates getopt option parsing and the rest of the options are part of ARGS closes #10226
👍 |
[image: 👍] |
Terminate argument parsing on `--`
println(STDERR, "julia: option `$arg` is missing an argument") | ||
exit(1) | ||
end | ||
idxs = find(x -> x == "--", args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the rationale for blocking the --
symbol from user arguments? the usual use of the --
flag is to permit use of --
as a filename (or other filenames that look like flags) to be permitted as an unprocessed inputs. as such, it seems odd to me to unconditionally block them.
i would also have expected the following to be valid to allow chaining, where --
terminates argument parsing for each subsequent parsing of ARGS
:
./julia -f -- ./filename.jl -- first args -- user args
currently, however, it doesn't get anywhere:
$ ./julia -f -- ./filename.jl -- first args -- user args
julia: redundant option terminator `--`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason. @vtjnash can you point to a source that explains this in more detail or gives an example? I've never seen what you have pointed out in the wild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gives an example
Do you mean to use --
to allow option like file name? Or allowing nesting it.
For the first one, I think most coreutils have that.
For the second one, at least the ArchLinux dev-tools is using it to allow passing arguments to different components in the chroot toolchain.
encountering a -- terminates getopt option parsing
and the rest of the options are part of ARGS
closes #10226