Skip to content

Commit

Permalink
Command line processing improvement
Browse files Browse the repository at this point in the history
- don't eat AttributeError
- use the parser's "error" method
  • Loading branch information
smurfix authored and Hugo Osvaldo Barrera committed May 15, 2018
1 parent 3ef8804 commit 94f8be8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions barcode/pybarcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ def main():
barcode='code39', text=None)
args = parser.parse_args()
try:
args.func(args, parser)
func = args.func
except AttributeError:
print("Use --help to see help")
parser.error("You need to tell me what to do.")
else:
func(args, parser)


if __name__ == '__main__':
Expand Down

0 comments on commit 94f8be8

Please sign in to comment.