Commit b9fa6384 authored by Antoine Beaupré's avatar Antoine Beaupré
Browse files

print usage when failing to parse commandline

parent 12b7dc39
......@@ -32,15 +32,19 @@ script assumes you have gpg-agent configure to prompt for passwords."""
usage = usage='%prog [options] <keyid>'
epilog='<keyid>: a GPG fingerprint or key id'
def parse_args(self, args):
"""override main parsing: we absolutely need an argument"""
parser = MonkeysignUi.parse_args(self, args)
if self.pattern is None:
parser.print_usage()
sys.exit('wrong number of arguments, use -h for full help')
def main(self):
"""main code execution loop
we expect to have the commandline parsed for us
"""
if self.pattern is None:
sys.exit('wrong number of arguments')
MonkeysignUi.main(self)
# 1. fetch the key into a temporary keyring
......
......@@ -109,7 +109,10 @@ Regards,
elif len(self.pattern) < 1:
self.pattern = None
else:
sys.exit('wrong number of arguments')
parser.print_usage()
sys.exit('wrong number of arguments, use -h for full help')
# make sure parser can be accessed outside of this function
return parser
def __init__(self, args = None):
# the options that determine how we operate, from the parse_args()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment