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

flag parser doesn't catch short flag with typos #843

Closed
cristiand391 opened this issue Oct 27, 2023 · 2 comments
Closed

flag parser doesn't catch short flag with typos #843

cristiand391 opened this issue Oct 27, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@cristiand391
Copy link
Member

cristiand391 commented Oct 27, 2023

Describe the bug
for a flag --target-org/-o, if I type -oasdf oclif doesn't throw Error (1): Nonexistent flag as expected, but instead parses it as:

flag: -o
value: asdf

To Reproduce

  1. install Salesforce CLI
  2. run sf project deploy start -oasdf dreamhouse (or any command with short flag+typo):
➜  dreamhouse-lwc git:(main) sf project deploy start -oasdf dreamhouse
Error (1): Parsing --target-org
        No authorization information found for asdf.
See more help with --help

long flag names aren't affected by this:

➜  dreamhouse-lwc git:(main) sf project deploy start --target-orgasdf dreamhouse
Error (1): Nonexistent flag: --target-orgasdf
See more help with --help

Expected behavior
shoud get the non-existent flag err if the short flag has a typo

sf version:
@salesforce/cli/2.15.8 darwin-x64 node-v18.17.0

Environment (please complete the following information):

  • OS & version: macos ventura
  • Shell/terminal & version: zsh/alacritty
@mdonnalley mdonnalley added the bug Something isn't working label Oct 27, 2023
@git2gus
Copy link

git2gus bot commented Oct 27, 2023

This issue has been linked to a new work item: W-14378968

@mdonnalley
Copy link
Contributor

@cristiand391 This is actually working as designed and it's a fairly well known pattern for unix commands

I'm not sure there's anything we can do to know whether -oasdf is a typo when -o is expecting a value. Also changing it now would be a breaking change. The only thing we could really do is add support for custom flag parsing so that CLIs can change this behavior if they want. But I'm not sure that would be worth the effort.

@mdonnalley mdonnalley closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants