This library contains types for supercharging and streamlining grabbing input from the command line. Gone are the days needing to messily handle whether the user wants you to read their input from stdin, or a file, or directly from the argument. Welcome to the future.
But as they say, "An example is worth a thousand words". Consider then, the following super simple rust CLI program:
use StructOpt;
use Input;
# type Result = Result;
#
#
Just by using [grab::Input] we can now respond to user input three ways:
# The basics, read the argument directly from the command line
# Read from stdin... in unixy fashion!
|
# Or even from a file!
;
Couldn't be simpler right?
"Okay, okay" you say, "this is great and all... but I want my CLI's users to refer to stdin as '<--' and files as '...'! Anything less just won't do. So thanks but no th...". Whoa, whoa! No problem (you psychopath) we can accommodate your (insane) needs. Simply modify the parser configuration to suit your needs!
# use StructOpt;
# use FromStr;
use ;
// Build our custom stdin parser
// And our custom file parser
// Then we define our newtype wrapper and implement FromStr
;
// And use it in our CLI!
There we have it. A custom parser which you can use however you like (you monster)!