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

Unexpected argument parsing #1286

Closed
vancegillies opened this issue Jul 14, 2022 · 2 comments · Fixed by #1287
Closed

Unexpected argument parsing #1286

vancegillies opened this issue Jul 14, 2022 · 2 comments · Fixed by #1287

Comments

@vancegillies
Copy link

Environment

Any I think

Steps to Reproduce

  1. run command like sentry-cli --auth-token token react-native appcenter DEPLOYMENT android ./build/CodePush --deployment Staging --dist 7 -org org --project app Notice the single -org that should be --org
  2. see this error
> Fetching latest AppCenter deployment info
> Processing react-native AppCenter sourcemaps
error: No such file or directory (os error 2)
  1. be really confused because other issue mentioning this error are about java args or metro workers
  2. pull this repo and change react-native/appcenter.rs line 136 and compile
for path in matches.values_of("paths").unwrap() {
        println!("WTF is this >>>>>>>>>>>>> :{}", path);
        for entry in (fs::read_dir(path)?).flatten() {
  1. run same command and see
> Fetching latest AppCenter deployment info
> Processing react-native AppCenter sourcemaps
WTF is this >>>>>>>>>>>>> :./build/CodePush
WTF is this >>>>>>>>>>>>> :org
error: No such file or directory (os error 2)
  1. Realise -org issue in command
  2. feel dumb and cry.

Expected Result

Would be nice if it gave you the same error as when it finds args it doesn't recognise

error: Found argument '--anything' which wasn't expected, or isn't valid in this context

or maybe output the path it errored on would have been super helpful

Actual Result

Gives a file system error because it some how parses the unknown arg as a path

> Fetching latest AppCenter deployment info
> Processing react-native AppCenter sourcemaps
error: No such file or directory (os error 2)
@kamilogorek
Copy link
Contributor

Hey, thanks for the detailed report. Unfortunately we cannot make it as nice as

error: Found argument '--anything' which wasn't expected, or isn't valid in this context

as this is coming directly from args parsing library. We need to allow values like -dir to be handled, as this is valid directory name in most systems.

And because paths are multi-value and position-independent arguments, they are not easily distinguishable.
I updated the error message here, which should let people find the problem way faster - #1287

Cheers!

@vancegillies
Copy link
Author

@kamilogorek I'm sure that will help future idiots like myself, cheers!

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 a pull request may close this issue.

2 participants