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

FEDX-970: Disallow (ignore) trailing options, as it inhibits ability to pass args to subcommand #18

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

evanweible-wf
Copy link
Contributor

@evanweible-wf evanweible-wf commented Jun 14, 2024

I removed the allowTrailingOptions: false in a recent PR, only to remember that it was supposed to be disabled. When trailing options are allowed, it becomes impossible to pass options/flags as args to the subcommand that dpx runs since the top-level dpx arg parser will try to parse them.

For example:

> dpx dependency_validator --help

This should run dependency_validator --help and display the help output for that executable, but it actually displays the help output for dpx. Similarly, if you tried to use a CLI flag or option of the subcommand, dpx would fail to parse args altogether.

While it's possible to workaround this by using an arg separator...

> dpx dependency_validator -- --help

... it's awkward and unintuitive. dpx is supposed to make it as easy to run other package executables, so we should aim to make the dpx CLI get out of the way whenever possible and favor the underlying package executable.

This PR makes that change by disallowing (ignoring) trailing options.

Note: the only real downside is that if you want to make dpx run in verbose mode, you have to add the --verbose flag first, like so:

> dpx --verbose dependency_validator

This is a minor inconvenience and an acceptable trade off.

@rmconsole3-wf rmconsole3-wf changed the title Disallow (ignore) trailing options, as it inhibits ability to pass args to subcommand FEDX-970 Disallow (ignore) trailing options, as it inhibits ability to pass args to subcommand Jun 14, 2024
@bender-wk bender-wk changed the title FEDX-970 Disallow (ignore) trailing options, as it inhibits ability to pass args to subcommand FEDX-970: Disallow (ignore) trailing options, as it inhibits ability to pass args to subcommand Jun 14, 2024
@aviary2-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@evanweible-wf
Copy link
Contributor Author

QA +1

  • Verified that this makes it possible to pass trailing args to the command run by dpx without using an arg separator

@Workiva/release-management-p

@rmconsole4-wk rmconsole4-wk merged commit 1c620e2 into master Jul 2, 2024
7 checks passed
Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

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

+1 from RM

@rmconsole4-wk rmconsole4-wk deleted the disallow-trailing-options branch July 2, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants