# HG changeset patch # User Franz Glasner # Date 1607093428 -3600 # Node ID 81f28bf89c269b473277c329564150d73a2e562d # Parent 048b97213a23b3caeffd667371a00ddc67673c31 Some more output selection options and documentation diff -r 048b97213a23 -r 81f28bf89c26 shasum.py --- a/shasum.py Fri Dec 04 15:18:40 2020 +0100 +++ b/shasum.py Fri Dec 04 15:50:28 2020 +0100 @@ -33,8 +33,14 @@ "--binary", "-b", action="store_false", dest="text_mode", default=False, help="read in binary mode (default)") aparser.add_argument( - "--bsd", "-B", action="store_true", - help="write BSD style output") + "--bsd", "-B", action="store_true", dest="bsd", default=False, + help="write BSD style output; also :command:`openssl dgst` style") + aparser.add_argument( + "--reverse", "-r", action="store_false", dest="bsd", default=False, + help="explicitely select normal coreutils style output (to be option compatible with BSD style commands and :command:`openssl dgst -r`)") + aparser.add_argument( + "--tag", action="store_true", dest="bsd", default=False, + help="alias for the `--bsd' option (to be compatible with :command:`b2sum`)") aparser.add_argument( "--text", "-t", action="store_true", dest="text_mode", default=False, help="read in text mode (not supported)") @@ -122,6 +128,10 @@ def out_bsd(dest, digest, filename, digestname, binary): + """BSD format output, also :command:`openssl dgst` and + :command:`b2sum --tag" format output + + """ if filename is None: print(digest, file=dest) else: @@ -130,6 +140,9 @@ def out_std(dest, digest, filename, digestname, binary): + """Coreutils format (:command:`shasum` et al.) + + """ print("{} {}{}".format(digest, '*' if binary else ' ', '-' if filename is None else filename),