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

Handle unrecognized cli arguments #1199

Closed
wants to merge 2 commits into from

Conversation

bartlomieju
Copy link
Member

This PR tries to fix #1198.

@@ -87,7 +87,7 @@ export default function denoMain() {
log("cwd", cwd);

// TODO handle shebang.
for (let i = 1; i < startResMsg.argvLength(); i++) {
for (let i = 0; i < startResMsg.argvLength(); i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional. I believe it serves the same purpose as your let args = env::args().skip(1).collect(); line below

// in userland)
// deno --allow-env foo.ts --foo=bar
// parsing will stop when `foo.ts` is encountered
opts.parsing_style(ParsingStyle::StopAtFirstFree);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm.. I'd rather not StopAtFirstFree. It would be nice to intermix flags from core and user programs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can show a test case of what's going wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies if I'm way out of line here since I'm just starting to get involved with deno and I might be misreading this comment.

Wouldn't intermixing flags from core and user programs cause problems down the line?

It looks like a clear separation is the only way to defend programs (and core) from potential issues that might arise from arguments being added / removed, and would avoid confusion?

example: deno program.ts --version is this passing --version to program? or to deno? both?
example2: deno program.ts --some-arg initially --some-arg is not a deno argument, but down the line, it's aded to deno, would the program stop working?

or did I get it wrong?

@bartlomieju
Copy link
Member Author

Let's continue in #1200

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.

Pass unrecognized command line arguments
3 participants