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

fix(task): subcommand parser skips global args #15297

Merged
merged 5 commits into from
Aug 10, 2022
Merged

Conversation

Cre3per
Copy link
Contributor

@Cre3per Cre3per commented Jul 24, 2022

Fixes #15290

I decided to slice args in flags_from_vec(), rather than in task_parse(), to avoid passing task_parse() more data than is necessary. This makes it easier to see that task_parse() doesn't care about the "--quiet" in deno --quiet task echo.

Not happy with the way I'm slicing the subcommand's args from args. I couldn't find anything in clap to get the index of the subcommand name, or a function like index_of() for subcommands. Suggestions are welcome.

@CLAassistant
Copy link

CLAassistant commented Jul 24, 2022

CLA assistant check
All committers have signed the CLA.

@niedzielski
Copy link

Hi @Cre3per! I'm not a maintainer just someone interested in seeing this patch merged! I just noticed that it looks like you have to sign the CLA if you want this code to be reviewed. Thanks either way!

@Cre3per
Copy link
Contributor Author

Cre3per commented Jul 29, 2022

Thanks for the reminder @niedzielski !

I pushed commits with a wrong email address, which I later amended, and thought the CLA checker was just slow to pick up the changes. I now force-pushed onto my fork.

@kt3k kt3k requested a review from dsherret August 5, 2022 04:37
@Cre3per
Copy link
Contributor Author

Cre3per commented Aug 5, 2022

@kt3k Github actions failure looks like #15385. Could you try re-running without changes?

@@ -2582,8 +2593,6 @@ fn task_parse(
}

if let Some(mut index) = matches.index_of("task_name_and_args") {
Copy link
Member

Choose a reason for hiding this comment

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

This index being out of sync with the raw_args index seems a bit error prone. In the interest of merging this for the release tomorrow, I'm going to push a change that keeps these in sync.

Copy link
Member

@dsherret dsherret Aug 10, 2022

Choose a reason for hiding this comment

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

Ok, I couldn't figure it out in a reasonable time. I moved this current code to be localized and your fix seems to work in a bunch of scenarios I tried so let's land it. Thanks!

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@dsherret dsherret merged commit afc29c2 into denoland:main Aug 10, 2022
bartlomieju pushed a commit to littledivy/deno that referenced this pull request Aug 11, 2022
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.

-q option position is inconsistent for the task subcommand
4 participants