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

Receive UnexpectedArgsError when wrapping args/flags #578

Closed
prescience-data opened this issue Dec 18, 2022 · 1 comment
Closed

Receive UnexpectedArgsError when wrapping args/flags #578

prescience-data opened this issue Dec 18, 2022 · 1 comment

Comments

@prescience-data
Copy link

Describe the bug
Not really a "bug" but more a DX issue, but thought I'd log it here in case there is interest in a PR.

In local dev testing we have a bash script that handles calling the oclif application from the top level of a monorepo (to avoid navigating down each time it's required).

# ./run
# Calls "<monorepo-root>/cli/bin/dev"
cd cli && rushx cli "${args}"

For shellcheck SC2086 the args are wrapped in double quotes.

Unfortunately, this triggers an UnexpectedArgsError when zero or > 1 args or flags are provided as the Parser sees them all as a single block.

To Reproduce
Steps to reproduce the behaviour:

  1. Create an oclif start application called "cli"
  2. Add a command with flags --foo and --bar that also callsthis.parse().
  3. In the parent folder, create the bash script from above called ./run.
  4. Execute ./run --foo
  5. Command works ✅
  6. Execute ./run (no args) or ./run --foo --bar=baz (multiple args)
  7. Command throws UnexpectedArgsError on ""

Expected behaviour
Would be amazing if the parser step here (or it's parent) could unwrap any double quotes from around args before parsing.

Environment:

  • OS & version: Ubuntu 22.04 LTS
  • Shell/terminal: bash
@mdonnalley
Copy link
Contributor

@prescience-data I believe this is out of scope for oclif as it seems unique to the script you're using to execute the cli. I'm going to close this for now but please feel free to re-open if you think there's something that I'm missing here. Thanks!

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

No branches or pull requests

2 participants