Use argparse
(python buil-in) so that delete argument is explicit, instead of ‘specify anything as the second parameter’ user has to use -d/--delete
to remove binaries after the check. Explicit is always better than implicit and I myself few times fat-fingered something behind the command and it deleted binaries that I wanted to keep. With this patch you get error for random things:
0usage: verify.py [-h] [-d] VERSION
1verify.py: error: unrecognized arguments: d
With argparse verify.py
now has a nice help message that is handy for scripts:
0usage: verify.py [-h] [-d] VERSION
1
2Download and verify bitcoin binaries.
3
4positional arguments:
5 VERSION Target version.
6
7optional arguments:
8 -h, --help show this help message and exit
9 -d, --delete Delete the downloaded binaries afterwards.
I aslo fixed error in README which previously stated that If an error occurs the return value is 2.
but correct is that it returns >= 2