changeset 20:8f0241ed4a00

Do not append "-" to an empty FILE list any more but check explicitely for an empty list
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 05 Dec 2020 12:54:44 +0100
parents 2f9e702e3f7a
children f2d634270e1c
files shasum.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/shasum.py	Sat Dec 05 00:13:27 2020 +0100
+++ b/shasum.py	Sat Dec 05 12:54:44 2020 +0100
@@ -73,8 +73,6 @@
     if not opts.algorithm:
         opts.algorithm = argv2algo("1")
 
-    if not opts.files:
-        opts.files.append('-')
     if opts.check:
         return verify_digests_from_files(opts)
     else:
@@ -86,7 +84,7 @@
         out = out_bsd
     else:
         out = out_std
-    if len(opts.files) == 1 and opts.files[0] == '-':
+    if not opts.files or (len(opts.files) == 1 and opts.files[0] == '-'):
         if PY2:
             if sys.platform == "win32":
                 import os, msvcrt   # noqa: E401
@@ -112,7 +110,7 @@
 
 def verify_digests_from_files(opts):
     exit_code = 0
-    if len(opts.files) == 1 and opts.files[0] == '-':
+    if not opts.files or (len(opts.files) == 1 and opts.files[0] == '-'):
         for checkline in sys.stdin:
             if not checkline:
                 continue