diff options
| author | Dan Willemsen <dwillemsen@google.com> | 2015-08-31 15:45:06 -0700 |
|---|---|---|
| committer | Dan Willemsen <dwillemsen@google.com> | 2015-09-01 12:23:56 -0700 |
| commit | 9ff2ece6abc5d0d4a69c2f086209f107fd4f04be (patch) | |
| tree | 1daabfe078e59b38ba0a1fdf9f6b0c83bcf7eba9 /subcmds | |
| parent | 2487cb7b2c41506c8ef900dba735876b01c67eab (diff) | |
| download | git-repo-9ff2ece6abc5d0d4a69c2f086209f107fd4f04be.tar.gz | |
gitc: Improve help visibilityv1.12.28
This improves the visiblity of gitc-init if we can get the gitc config,
and hides it otherwise.
Change-Id: I82830b0b07c311e8c74397ba79eb4c361f8b6fb5
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/gitc_init.py | 3 | ||||
| -rw-r--r-- | subcmds/help.py | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py index c0568caa..e99affa5 100644 --- a/subcmds/gitc_init.py +++ b/subcmds/gitc_init.py | |||
| @@ -18,10 +18,11 @@ import os | |||
| 18 | import sys | 18 | import sys |
| 19 | 19 | ||
| 20 | import gitc_utils | 20 | import gitc_utils |
| 21 | from command import RequiresGitcCommand | ||
| 21 | from subcmds import init | 22 | from subcmds import init |
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | class GitcInit(init.Init): | 25 | class GitcInit(init.Init, RequiresGitcCommand): |
| 25 | common = True | 26 | common = True |
| 26 | helpSummary = "Initialize a GITC Client." | 27 | helpSummary = "Initialize a GITC Client." |
| 27 | helpUsage = """ | 28 | helpUsage = """ |
diff --git a/subcmds/help.py b/subcmds/help.py index 4aa3f863..ae5b8f08 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
| @@ -19,7 +19,8 @@ import sys | |||
| 19 | from formatter import AbstractFormatter, DumbWriter | 19 | from formatter import AbstractFormatter, DumbWriter |
| 20 | 20 | ||
| 21 | from color import Coloring | 21 | from color import Coloring |
| 22 | from command import PagedCommand, MirrorSafeCommand | 22 | from command import PagedCommand, MirrorSafeCommand, RequiresGitcCommand |
| 23 | import gitc_utils | ||
| 23 | 24 | ||
| 24 | class Help(PagedCommand, MirrorSafeCommand): | 25 | class Help(PagedCommand, MirrorSafeCommand): |
| 25 | common = False | 26 | common = False |
| @@ -54,9 +55,17 @@ Displays detailed usage information about a command. | |||
| 54 | def _PrintCommonCommands(self): | 55 | def _PrintCommonCommands(self): |
| 55 | print('usage: repo COMMAND [ARGS]') | 56 | print('usage: repo COMMAND [ARGS]') |
| 56 | print('The most commonly used repo commands are:') | 57 | print('The most commonly used repo commands are:') |
| 58 | |||
| 59 | def gitc_supported(cmd): | ||
| 60 | if not isinstance(cmd, RequiresGitcCommand): | ||
| 61 | return True | ||
| 62 | if gitc_utils.get_gitc_manifest_dir(): | ||
| 63 | return True | ||
| 64 | return False | ||
| 65 | |||
| 57 | commandNames = list(sorted([name | 66 | commandNames = list(sorted([name |
| 58 | for name, command in self.commands.items() | 67 | for name, command in self.commands.items() |
| 59 | if command.common])) | 68 | if command.common and gitc_supported(command)])) |
| 60 | 69 | ||
| 61 | maxlen = 0 | 70 | maxlen = 0 |
| 62 | for name in commandNames: | 71 | for name in commandNames: |
