Argument Parsing with spaces?
See original GitHub issueI’m not sure if is an edge case that yargs should address.
When a program is executed from a script like bash -e /script_run_yargs_program.sh
ie GitHub actions run:
if there are any trailing spaces after a slash on a multi-line script they get interrupted as an argument and you get a very unhelpful error message
Unknown argument:
being akin to printf("Unknown argument: %s" , " ")
see: https://github.com/iterative/cml/issues/727#issuecomment-924443434 for an example
I realize this could be an unsupported edge case and Ideally people aren’t putting trailing spaces after their 's 😉
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Handle spaces in argparse input - python - Stack Overflow
Simple solution: argparse considers a space filled string as a single argument if it is encapsulated by quotation marks.
Read more >Parsing C command-line arguments - Microsoft Learn
Arguments are delimited by whitespace characters, which are either spaces or tabs. The first argument ( argv[0] ) is treated specially. It ...
Read more >Python Script Execution error while passing the string with space
If you want to pass named string arguments containing spaces in between to the python script, you can simply put the text in...
Read more >How to parse arguments with space inside bash function
Sounds like you want to split the first argument your function receives on space characters. For that, you could use the split+glob operator ......
Read more >Passing arguments with spaces? · Issue #39 · trevorld/r-optparse
Hi, is there any way to pass arguments with spaces? I currently need to pass a filename and it keeps splitting it into...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DanielBarnes, I like @0x2b3bfa0’s suggestion… I don’t thin kit would be ridiculous to
trim
the strings we parse too, I’d have to look at the parser to see how painful this is.It would be nice to quote unknown options so users can notice whitespace: