gsscoder / commandline

Terse syntax C# command line parser for .NET with F# support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using dash "-" to define stdout not working

TheDeadCode opened this issue · 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.
commented

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

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