diff options
author | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-01 11:11:04 -0700 |
---|---|---|
committer | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-16 15:30:13 -0700 |
commit | 262c789754931d95a4bb567fc59a3ffb833ed1bb (patch) | |
tree | 56850ddddf59cd52b401210d8cea0154781973c3 /mediagoblin/gmg_commands/util.py | |
parent | aa387fc57ec1c176a739df8c5f4cedaf70ae9af1 (diff) | |
download | mediagoblin-262c789754931d95a4bb567fc59a3ffb833ed1bb.tar.lz mediagoblin-262c789754931d95a4bb567fc59a3ffb833ed1bb.tar.xz mediagoblin-262c789754931d95a4bb567fc59a3ffb833ed1bb.zip |
Throw an error if there are unrecognized arguments
Diffstat (limited to 'mediagoblin/gmg_commands/util.py')
-rw-r--r-- | mediagoblin/gmg_commands/util.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mediagoblin/gmg_commands/util.py b/mediagoblin/gmg_commands/util.py index 6a6853d5..8b057996 100644 --- a/mediagoblin/gmg_commands/util.py +++ b/mediagoblin/gmg_commands/util.py @@ -17,6 +17,7 @@ from mediagoblin import app import getpass +import argparse def setup_app(args): @@ -36,5 +37,11 @@ def prompt_if_not_set(variable, text, password=False): variable=raw_input(text + u' ') else: variable=getpass.getpass(text + u' ') - + return variable + + +def check_unrecognized_args(args): + if args[1]: + parser = argparse.ArgumentParser() + parser.error('unrecognized arguments: {}'.format(args[1])) |