1616
1717log = logging .getLogger (__name__ )
1818
19+ SYNC_DESCRIPTION = textwrap .dedent (
20+ """
21+ sync vcs repos
22+
23+ examples:
24+ vcspull sync "*"
25+ vcspull sync "django-*"
26+ vcspull sync "django-*" flask
27+ vcspull sync -c ./myrepos.yaml "*"
28+ vcspull sync -c ./myrepos.yaml myproject
29+ """
30+ ).strip ()
31+
1932
2033def create_parser ():
2134 parser = argparse .ArgumentParser (
2235 prog = "vcspull" ,
2336 formatter_class = argparse .RawDescriptionHelpFormatter ,
24- description = textwrap .dedent (
25- """
26- sync vcspull repos
27-
28- examples:
29- vcspull sync "*"
30- vcspull sync "django-*"
31- vcspull sync "django-*" flask
32- vcspull sync -c "myrepos.yaml" "*"
33- vcspull sync -c "myrepos.yaml" myproject
34- """
35- ).strip (),
37+ description = SYNC_DESCRIPTION ,
3638 )
3739 parser .add_argument (
3840 "--version" ,
@@ -42,20 +44,26 @@ def create_parser():
4244 )
4345 parser .add_argument (
4446 "--log-level" ,
47+ metavar = "level" ,
4548 action = "store" ,
4649 default = "INFO" ,
47- help = "log level (DEBUG, INFO, WARNING, ERROR, CRITICAL )" ,
50+ help = "log level (debug, info, warning, error, critical )" ,
4851 )
4952
5053 subparsers = parser .add_subparsers (dest = "subparser_name" )
51- sync_parser = subparsers .add_parser ("sync" , help = "synchronize repos" )
54+ sync_parser = subparsers .add_parser (
55+ "sync" ,
56+ help = "synchronize repos" ,
57+ formatter_class = argparse .RawDescriptionHelpFormatter ,
58+ description = SYNC_DESCRIPTION ,
59+ )
5260 create_sync_subparser (sync_parser )
5361
54- return parser
62+ return parser , sync_parser
5563
5664
5765def cli (args = None ):
58- parser = create_parser ()
66+ parser , sync_parser = create_parser ()
5967 args = parser .parse_args (args )
6068
6169 setup_logger (log = log , level = args .log_level .upper ())
@@ -68,5 +76,5 @@ def cli(args=None):
6876 repo_terms = args .repo_terms ,
6977 config = args .config ,
7078 exit_on_error = args .exit_on_error ,
71- parser = parser ,
79+ parser = sync_parser ,
7280 )
0 commit comments