This takes @chrp's work from #11 and extends it with a bit more CLI stuff.
Honestly, I might have got a bit carried away with this. Possibly over-engineered the situation with OptionParser but it doesn't add any more dependencies (yay stdlib) and it does do a bunch of things I'd expect from a CLI. Including:
Returns help text if you don't pass any arguments
Returns help text if you pass -h or --help flags
Returns the version of the program if you pass the -v or --version flag
It also allows you to pass a password to be tested directly from calling the executable:
$ pwned password
Pwned!
The password has been found in public breaches 3645804 times.
Or you can pass the -s or --secret flag and type in the password without it being seen:
$ pwned --secret
Password:
Pwned!
The password has been found in public breaches 3645804 times.
This takes @chrp's work from #11 and extends it with a bit more CLI stuff.
Honestly, I might have got a bit carried away with this. Possibly over-engineered the situation with
OptionParser
but it doesn't add any more dependencies (yay stdlib) and it does do a bunch of things I'd expect from a CLI. Including:-h
or--help
flags-v
or--version
flagIt also allows you to pass a password to be tested directly from calling the executable:
Or you can pass the
-s
or--secret
flag and type in the password without it being seen: