diff options
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -46,6 +46,9 @@ global_options.add_option('-p', '--paginate', | |||
46 | global_options.add_option('--no-pager', | 46 | global_options.add_option('--no-pager', |
47 | dest='no_pager', action='store_true', | 47 | dest='no_pager', action='store_true', |
48 | help='disable the pager') | 48 | help='disable the pager') |
49 | global_options.add_option('--version', | ||
50 | dest='show_version', action='store_true', | ||
51 | help='display this version of repo') | ||
49 | 52 | ||
50 | class _Repo(object): | 53 | class _Repo(object): |
51 | def __init__(self, repodir): | 54 | def __init__(self, repodir): |
@@ -69,6 +72,13 @@ class _Repo(object): | |||
69 | argv = [] | 72 | argv = [] |
70 | gopts, gargs = global_options.parse_args(glob) | 73 | gopts, gargs = global_options.parse_args(glob) |
71 | 74 | ||
75 | if gopts.show_version: | ||
76 | if name == 'help': | ||
77 | name = 'version' | ||
78 | else: | ||
79 | print >>sys.stderr, 'fatal: invalid usage of --version' | ||
80 | sys.exit(1) | ||
81 | |||
72 | try: | 82 | try: |
73 | cmd = self.commands[name] | 83 | cmd = self.commands[name] |
74 | except KeyError: | 84 | except KeyError: |