diff options
Diffstat (limited to 'repo')
-rwxr-xr-x | repo | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -819,6 +819,7 @@ def _FindRepo(): | |||
819 | 819 | ||
820 | class _Options(object): | 820 | class _Options(object): |
821 | help = False | 821 | help = False |
822 | version = False | ||
822 | 823 | ||
823 | 824 | ||
824 | def _ParseArguments(args): | 825 | def _ParseArguments(args): |
@@ -830,7 +831,8 @@ def _ParseArguments(args): | |||
830 | a = args[i] | 831 | a = args[i] |
831 | if a == '-h' or a == '--help': | 832 | if a == '-h' or a == '--help': |
832 | opt.help = True | 833 | opt.help = True |
833 | 834 | elif a == '--version': | |
835 | opt.version = True | ||
834 | elif not a.startswith('-'): | 836 | elif not a.startswith('-'): |
835 | cmd = a | 837 | cmd = a |
836 | arg = args[i + 1:] | 838 | arg = args[i + 1:] |
@@ -877,6 +879,16 @@ def _Help(args): | |||
877 | sys.exit(1) | 879 | sys.exit(1) |
878 | 880 | ||
879 | 881 | ||
882 | def _Version(): | ||
883 | """Show version information.""" | ||
884 | print('<repo not installed>') | ||
885 | print('repo launcher version %s' % ('.'.join(str(x) for x in VERSION),)) | ||
886 | print(' (from %s)' % (__file__,)) | ||
887 | print('git %s' % (ParseGitVersion().full,)) | ||
888 | print('Python %s' % sys.version) | ||
889 | sys.exit(0) | ||
890 | |||
891 | |||
880 | def _NotInstalled(): | 892 | def _NotInstalled(): |
881 | print('error: repo is not installed. Use "repo init" to install it here.', | 893 | print('error: repo is not installed. Use "repo init" to install it here.', |
882 | file=sys.stderr) | 894 | file=sys.stderr) |
@@ -953,6 +965,8 @@ def main(orig_args): | |||
953 | _Usage() | 965 | _Usage() |
954 | if cmd == 'help': | 966 | if cmd == 'help': |
955 | _Help(args) | 967 | _Help(args) |
968 | if opt.version or cmd == 'version': | ||
969 | _Version() | ||
956 | if not cmd: | 970 | if not cmd: |
957 | _NotInstalled() | 971 | _NotInstalled() |
958 | if cmd == 'init' or cmd == 'gitc-init': | 972 | if cmd == 'init' or cmd == 'gitc-init': |