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

`zig run [source]` does not accept arguments for launched executable #2148

Closed
mikdusan opened this Issue Mar 31, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@mikdusan
Copy link
Contributor

mikdusan commented Mar 31, 2019

bug case 1: origin of issue

$ zig run parser.zig hello
Unexpected extra parameter: hello
See `zig --help` for detailed usage information

bug case 2: generic unix command-line syntax

$ zig run parser.zig -- hello
Invalid argument: --
See `zig --help` for detailed usage information

bug case 3: what does it do with just --

$ zig run parser.zig --      
Expected another argument after --
See `zig --help` for detailed usage information

Using case 1 syntax there is ambiguity. For example, you could not run main() that accepted --help because zig command line processing would eat it.

So I think we should go with explicit syntax to mark end-of-parameter processing by zig. It's both unambiguous and common practice for these situations.

@andrewrk andrewrk added this to the 0.4.0 milestone Mar 31, 2019

mikdusan added a commit to mikdusan/zig that referenced this issue Mar 31, 2019

fix zig run to accept executable args
The `--` double-hyphen is now used to end further `zig` processing
of command line options. All arguments after `--` will be passed
on to the executable. eg. `--help` will be passed on.

`zig run foo.zig -- --help`

closes ziglang#2148

andrewrk added a commit that referenced this issue Mar 31, 2019

fix zig run to accept executable args
The `--` double-hyphen is now used to end further `zig` processing
of command line options. All arguments after `--` will be passed
on to the executable. eg. `--help` will be passed on.

`zig run foo.zig -- --help`

closes #2148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.