Open OnkelTem opened 6 years ago
At the moment our parser can not handle -
without a short option following it. The majority of bash commands handle stdin input without the need for the dash at the end of the command so it has not been a priority to implement.
In any case; reading data from stdin is beyond the scope of this library, being a command line argument parser, and is left for the user to implement.
You can use needs
and/or map
to handle arguments that are required to be supplied or optionally piped in through stdin.
The majority of bash commands handle stdin input without the need for the dash at the end of the command...
I'm not sure about what do you exactly mean under 'bash commands', but that's of course not true for the majority of standard set of *nix programs (e.g.: tar). Any detection magic is more a flaw than a feature. Programs shouldn't make any assumptions about their environment unless they're told explicitly what to do. And detecting stdin/stdout on PHP particularly - is a well know kind of perversion, yeah :)
You can use
needs
and/ormap
to handle arguments that are required to be supplied or optionally piped in through stdin.
Thanks, I'll take a look. Another workaround I used - I tweaked $_SERVER['argv}']
taking my positional argument out of there.
@OnkelTem Initializing Command($tokens)
with a modified token list can be useful! That is usually how I do my sub-commands.
It's very common for a file processing script to either take the filename OR '-' to get data from stdin. With this library I cannot do this:
Whenever I pass "-" it says
My definition was like:
and value reading part was as simple as: