From bfaa046a317f878af6270074bd360bb31049c46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Fri, 16 Oct 2015 11:40:22 -0400 Subject: [PATCH] add standard --version argument this way the version can be discovered by scripts without having to part the output of 'help'. it is removed from the 'help' output itself because it is prettier without the complete version number, and then the description can be reused elsewhere as well without needing the version number --- borg/archiver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/borg/archiver.py b/borg/archiver.py index f6da5e1ea..c4c391e2d 100644 --- a/borg/archiver.py +++ b/borg/archiver.py @@ -564,7 +564,9 @@ Type "Yes I am sure" if you understand this and want to continue.\n""") common_parser.add_argument('--remote-path', dest='remote_path', default=RemoteRepository.remote_path, metavar='PATH', help='set remote path to executable (default: "%(default)s")') - parser = argparse.ArgumentParser(prog=prog, description='Borg %s - Deduplicated Backups' % __version__) + parser = argparse.ArgumentParser(prog=prog, description='Borg - Deduplicated Backups') + parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__, + help='show version number and exit') subparsers = parser.add_subparsers(title='Available commands') serve_epilog = textwrap.dedent("""