Fix handling of version in argument parser
This commit is contained in:
parent
2871588703
commit
4b21fa1355
@ -59,9 +59,9 @@ def execute(raw_args=sys.argv):
|
||||
uis.init_ui(conf)
|
||||
ui = uis.get_ui()
|
||||
|
||||
parser = argparse.ArgumentParser(parents=[conf_parser],
|
||||
description="research papers repository",
|
||||
prog="pubs", version=__version__, add_help=True)
|
||||
parser = argparse.ArgumentParser(description="research papers repository",
|
||||
prog="pubs", add_help=True)
|
||||
parser.add_argument('--version', action='version', version=__version__)
|
||||
subparsers = parser.add_subparsers(title="valid commands", dest="command")
|
||||
cmd_funcs = collections.OrderedDict()
|
||||
for cmd_name, cmd_mod in CORE_CMDS.items():
|
||||
|
@ -85,10 +85,12 @@ def update(conf, code_version, repo_version, path=None):
|
||||
new_conf_text = io.BytesIO()
|
||||
default_conf.write(outfile=new_conf_text)
|
||||
|
||||
|
||||
if new_conf_text.getvalue() != old_conf_text:
|
||||
|
||||
backup_path = path + '.old'
|
||||
shutil.move(path, backup_path)
|
||||
default_conf.filename = path
|
||||
config.save_conf(default_conf)
|
||||
|
||||
uis.init_ui(default_conf)
|
||||
|
@ -18,7 +18,7 @@ from pubs.commands import init_cmd, import_cmd
|
||||
|
||||
|
||||
# makes the tests very noisy
|
||||
messagePUT=False
|
||||
PRINT_OUTPUT=False
|
||||
CAPTURE_OUTPUT=True
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ class CommandTestCase(unittest.TestCase):
|
||||
except fake_env.FakeInput.UnexpectedInput:
|
||||
self.fail('Unexpected input asked by command: {}.'.format(
|
||||
actual_cmd))
|
||||
if messagePUT:
|
||||
if PRINT_OUTPUT:
|
||||
print(outs)
|
||||
return outs
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user