|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -""" |
3 | | -This script is a Python implementation of `simplest-git-subrepos <https://github.com/jmnavarrol/simplest-git-subrepos>`_. |
4 | 2 |
|
5 | | -:package: multigit |release| |
6 | | -:author: `Jesús M. Navarro <mailto:[email protected]>`_ |
7 | | -:license: `GNU General Public License v3.0 <https://github.com/jmnavarrol/python-multigit/blob/main/LICENSE>`_ |
8 | | -:source: https://github.com/jmnavarrol/python-multigit |
9 | | -""" |
10 | | - |
11 | | -__version__ = '0.11.6' |
12 | | - |
13 | | -# Import stuff |
14 | | -import os, sys |
15 | | -import argparse |
16 | | - |
17 | | -# "local" imports |
18 | | -from .subrepos import Subrepos, SUBREPOS_FILE |
19 | | -# Other imports so there's visibility of all classes in the module |
| 3 | +from .__main__ import __version__ |
20 | 4 | from .gitrepo import Gitrepo |
21 | | -from .subrepofile import Subrepofile |
22 | | - |
23 | | - |
24 | | - |
25 | | -# MAIN entry point |
26 | | -def main(): |
27 | | - '''Processes command line parameters''' |
28 | | - parser = argparse.ArgumentParser( |
29 | | - description="Manages git repos within git repos.", |
30 | | - add_help=False, # this way I can force help to be an exclusion option along the others |
31 | | - ) |
32 | | - |
33 | | -# Main options |
34 | | - main_parser = parser.add_mutually_exclusive_group() |
35 | | - main_parser.add_argument('-h', '--help', action='store_true', help="Shows this help.") |
36 | | - main_parser.add_argument('-V', '--version', action='store_true', help="Shows " + parser.prog + " version and quits.") |
37 | | - main_parser.add_argument('-r', '--run', action='store_true', help="Recursively processes '" + SUBREPOS_FILE + "' files found.") |
38 | | - main_parser.add_argument('-s', '--status', action='store_true', help="Shows repositories' current status.") |
39 | | - |
40 | | -# Ready to parse args |
41 | | - args = parser.parse_args() |
42 | | - #print(args) |
43 | | - |
44 | | -# Run on the options |
45 | | - if len(sys.argv) > 1: |
46 | | - if args.help: |
47 | | - print("%s (%s)\n" % (parser.prog, __version__)) |
48 | | - parser.print_help() |
49 | | - elif args.version: |
50 | | - print("%s %s" % (parser.prog, __version__)) |
51 | | - else: |
52 | | - my_subrepos = Subrepos() |
53 | | - my_subrepos.process(os.getcwd(), report_only=args.status) |
54 | | - else: |
55 | | - # Program called with no arguments (shows help) |
56 | | - print("%s (%s): arguments required.\n" % (parser.prog, __version__)) |
57 | | - parser.print_help() |
58 | | - |
59 | | - |
60 | | -if __name__ == '__main__': |
61 | | - # execute only if run as a script |
62 | | - sys.exit(main()) |
| 5 | +from .subrepos import Subrepos |
0 commit comments