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(cli): error on out of place run args #9445

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chris-olszewski
Copy link
Member

Description

Currently we have a bug where run args can be specified incorrectly and we'll silently ignore them.

  • Specified for non-run commands e.g. turbo --no-daemon watch
  • Specified before a subcommand e.g. turbo --filter=foo run build turbo --filter=foo watch build which will silently ignore any arguments provided before the subcommand.

This PR makes these explicit failures instead of silently ignoring them. There is a solution where we attempt to "merge" args provided on either side of the subcommand, but that would require us to switch to clap's builder interface which would make our 80 line top level CLI interface ~1k lines. I do not think this is worth the time to go about that refactor to allow for awkward syntax.

⚠️ This will very possibly break user workflows, but I think this is better than our current ignoring of user provided flags. We could warn here, but I'm afraid that those warnings would go unseen.

I suggest reviewing each commit individually as there was some required refactoring to unit test this behavior.

Testing Instructions

Added unit tests

Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 3:29pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm
examples-gatsby-web ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm
examples-native-web ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm
examples-svelte-web ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm
examples-tailwind-web ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm
examples-vite-web ⬜️ Ignored (Inspect) Nov 15, 2024 3:29pm

@chris-olszewski chris-olszewski marked this pull request as ready for review November 15, 2024 16:01
@chris-olszewski chris-olszewski requested a review from a team as a code owner November 15, 2024 16:01
if self.run_args.is_some()
&& !matches!(
self.command,
None | Some(Command::Run { .. }) | Some(Command::Config)
Copy link
Member Author

Choose a reason for hiding this comment

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

We special list config since we use it for tests.

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.

1 participant