Skip to content

Commit 94f8be8

Browse files
smurfixHugo Osvaldo Barrera
authored andcommitted
Command line processing improvement
- don't eat AttributeError - use the parser's "error" method
1 parent 3ef8804 commit 94f8be8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

barcode/pybarcode.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ def main():
112112
barcode='code39', text=None)
113113
args = parser.parse_args()
114114
try:
115-
args.func(args, parser)
115+
func = args.func
116116
except AttributeError:
117-
print("Use --help to see help")
117+
parser.error("You need to tell me what to do.")
118+
else:
119+
func(args, parser)
118120

119121

120122
if __name__ == '__main__':

0 commit comments

Comments
 (0)