diff options
| author | Dan Willemsen <dwillemsen@google.com> | 2015-08-31 15:45:06 -0700 |
|---|---|---|
| committer | Dan Willemsen <dwillemsen@google.com> | 2015-09-29 13:46:34 -0700 |
| commit | 79360640f4c7d5f044973aa1bdb6fb0f8f311f05 (patch) | |
| tree | de0228e9e44b05ad3da07d4e8829a90bebb3871f /subcmds | |
| parent | 7b01b2fd01f4e37688242db19c93feb27f9b65c6 (diff) | |
| download | git-repo-79360640f4c7d5f044973aa1bdb6fb0f8f311f05.tar.gz | |
Add GitcClientCommand class for GITC-specific commands
These won't show up as common commands in the help text unless in a GITC
client, and will refuse to execute.
Change-Id: Iffe82adcc9d6ddde9cb4b204f83ff018042bdab0
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/gitc_init.py | 4 | ||||
| -rw-r--r-- | subcmds/help.py | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py index c243bb3b..4f9d7344 100644 --- a/subcmds/gitc_init.py +++ b/subcmds/gitc_init.py | |||
| @@ -18,12 +18,12 @@ 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 command import GitcAvailableCommand |
| 22 | from manifest_xml import GitcManifest | 22 | from manifest_xml import GitcManifest |
| 23 | from subcmds import init | 23 | from subcmds import init |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | class GitcInit(init.Init, RequiresGitcCommand): | 26 | class GitcInit(init.Init, GitcAvailableCommand): |
| 27 | common = True | 27 | common = True |
| 28 | helpSummary = "Initialize a GITC Client." | 28 | helpSummary = "Initialize a GITC Client." |
| 29 | helpUsage = """ | 29 | helpUsage = """ |
diff --git a/subcmds/help.py b/subcmds/help.py index ae5b8f08..9bb4c8c7 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
| @@ -19,7 +19,7 @@ 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, RequiresGitcCommand | 22 | from command import PagedCommand, MirrorSafeCommand, GitcAvailableCommand, GitcClientCommand |
| 23 | import gitc_utils | 23 | import gitc_utils |
| 24 | 24 | ||
| 25 | class Help(PagedCommand, MirrorSafeCommand): | 25 | class Help(PagedCommand, MirrorSafeCommand): |
| @@ -57,8 +57,12 @@ Displays detailed usage information about a command. | |||
| 57 | print('The most commonly used repo commands are:') | 57 | print('The most commonly used repo commands are:') |
| 58 | 58 | ||
| 59 | def gitc_supported(cmd): | 59 | def gitc_supported(cmd): |
| 60 | if not isinstance(cmd, RequiresGitcCommand): | 60 | if not isinstance(cmd, GitcAvailableCommand) and not isinstance(cmd, GitcClientCommand): |
| 61 | return True | 61 | return True |
| 62 | if self.manifest.isGitcClient: | ||
| 63 | return True | ||
| 64 | if isinstance(cmd, GitcClientCommand): | ||
| 65 | return False | ||
| 62 | if gitc_utils.get_gitc_manifest_dir(): | 66 | if gitc_utils.get_gitc_manifest_dir(): |
| 63 | return True | 67 | return True |
| 64 | return False | 68 | return False |
