Skip to content
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

Merged
merged 1 commit into from
Apr 3, 2015
Merged

Terminate argument parsing on -- #10726

merged 1 commit into from
Apr 3, 2015

Conversation

jakebolewski
Copy link
Member

encountering a -- terminates getopt option parsing
and the rest of the options are part of ARGS

closes #10226

encountering a -- terminates getopt option parsing
and the rest of the options are part of ARGS

closes #10226
@StefanKarpinski
Copy link
Member

👍

@kmsquire
Copy link
Member

kmsquire commented Apr 3, 2015

[image: 👍]

jakebolewski added a commit that referenced this pull request Apr 3, 2015
Terminate argument parsing on `--`
@jakebolewski jakebolewski merged commit 3231e58 into master Apr 3, 2015
@jakebolewski jakebolewski deleted the jcb/ddargs branch April 3, 2015 05:59
println(STDERR, "julia: option `$arg` is missing an argument")
exit(1)
end
idxs = find(x -> x == "--", args)
Copy link
Member

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 `--`

Copy link
Member Author

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.

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

argument parsing: make -- argument terminate parsing
5 participants