spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Wrong handling of empty string and space values (e.g. `--order-by=""` or `--order-by=" "`)

Open sandreas opened this issue 2 years ago • 0 comments

Information

  • OS: Linux, Ubuntu 18.04 LTS
  • Version: 0.44
  • Terminal: xterm-256color, zsh

Describe the bug Providing an empty value for a string option is not possible in my test project.

cli-tester test input.mp3 --order-by=""


Error: Expected an option value.

       test input.mp3 --order-by=
                                 ^ Did you forget the option value?

I would consider an empty string as a valid value. Even stranger, if I provide a space ( ) as value, it gets trimmed, although I never did that myself:

cli-tester test input.mp3 --order-by=" "
order-by=<> # no error, but no space!!?

To Reproduce

  • Compile https://github.com/sandreas/tone/tree/main/cli-tester
  • Run the above examples

Expected behavior

  • If I provide an empty option (cli-tester test input.mp3 --order-by=""), the value should be considered as valid
  • If I provide a space as option (cli-tester test input.mp3 --order-by=" "), the given value should be preserved as is and not trimmed (I would expect that for ANY value)

Maybe I am doing something wrong?!

sandreas avatar Jun 05 '22 11:06 sandreas