commandline icon indicating copy to clipboard operation
commandline copied to clipboard

Using dash "-" to define stdout not working

Open TheDeadCode opened this issue 7 years ago • 2 comments

A bit like wget where you can do wget https://someurl -O - to say to output to stdout. Although I cannot get it to work:

./generator.exe -o -

ERROR(S):
  Option 'o, output' has no value.
  Required option 'o, output' is missing.

TheDeadCode avatar Aug 05 '17 18:08 TheDeadCode

I'm not sure the library accepts - as a standalone value. Can you use something else for your purposes?

nemec avatar Aug 08 '17 06:08 nemec

The '-' for specifying "input from stdin" is a one of two common conventions on *nix utilities. This library doesn't support that. You could use the other common convention, of "if no file is specified, used stdin for input" or you could go with these alternatives:

  • use --stdin option to specify input from stdin
  • use --file or a file parameter that is empty to switch the "mode of input" to stdin instead of the specified file

The other alternative could be search the arg[] to detect the '-' by itself and set your own stdin=true flag before passing it into the library

ericnewton76 avatar Aug 08 '17 13:08 ericnewton76