|
1 | 1 | from __future__ import print_function
|
2 | 2 |
|
| 3 | +from argparse import RawDescriptionHelpFormatter |
| 4 | + |
3 | 5 | import code42cli.arguments as main_args
|
4 | 6 | import code42cli.profile.password as password
|
5 | 7 | from code42cli.compat import str
|
@@ -52,14 +54,48 @@ def init(subcommand_parser):
|
52 | 54 | Args:
|
53 | 55 | subcommand_parser: The subparsers group created by the parent parser.
|
54 | 56 | """
|
55 |
| - parser_profile = subcommand_parser.add_parser(u"profile") |
56 |
| - profile_subparsers = parser_profile.add_subparsers() |
57 |
| - |
58 |
| - parser_for_show = profile_subparsers.add_parser(u"show") |
59 |
| - parser_for_set = profile_subparsers.add_parser(u"set") |
60 |
| - parser_for_reset_password = profile_subparsers.add_parser(u"reset-pw") |
61 |
| - parser_for_list = profile_subparsers.add_parser(u"list") |
62 |
| - parser_for_use = profile_subparsers.add_parser(u"use") |
| 57 | + |
| 58 | + description = u""" |
| 59 | + Subcommands: |
| 60 | + show - Print the details of a profile. |
| 61 | + set - Create or update profile settings. The first profile created will be the default. |
| 62 | + reset-pw - Change the stored password for a profile. |
| 63 | + list - Show all existing stored profiles. |
| 64 | + use - Set a profile as the default. |
| 65 | + """ |
| 66 | + parser_profile = subcommand_parser.add_parser( |
| 67 | + u"profile", |
| 68 | + formatter_class=RawDescriptionHelpFormatter, |
| 69 | + description=description, |
| 70 | + usage=u"code42 profile <subcommand> <optional args>", |
| 71 | + ) |
| 72 | + profile_subparsers = parser_profile.add_subparsers(title="subcommands") |
| 73 | + |
| 74 | + parser_for_show = profile_subparsers.add_parser( |
| 75 | + u"show", |
| 76 | + description=u"Print the details of a profile.", |
| 77 | + usage=u"code42 profile show <optional-args>", |
| 78 | + ) |
| 79 | + parser_for_set = profile_subparsers.add_parser( |
| 80 | + u"set", |
| 81 | + description=u"Create or update profile settings. The first profile created will be the default.", |
| 82 | + usage=u"code42 profile set <optional-args>", |
| 83 | + ) |
| 84 | + parser_for_reset_password = profile_subparsers.add_parser( |
| 85 | + u"reset-pw", |
| 86 | + description=u"Change the stored password for a profile.", |
| 87 | + usage=u"code42 profile reset-pw <optional-args>", |
| 88 | + ) |
| 89 | + parser_for_list = profile_subparsers.add_parser( |
| 90 | + u"list", |
| 91 | + description=u"Show all existing stored profiles.", |
| 92 | + usage=u"code42 profile list <optional-args>", |
| 93 | + ) |
| 94 | + parser_for_use = profile_subparsers.add_parser( |
| 95 | + u"use", |
| 96 | + description=u"Set a profile as the default.", |
| 97 | + usage=u"code42 profile use <profile-name>", |
| 98 | + ) |
63 | 99 |
|
64 | 100 | parser_for_show.set_defaults(func=show_profile)
|
65 | 101 | parser_for_set.set_defaults(func=set_profile)
|
|
0 commit comments