gitc: Improve help visibility
This improves the visiblity of gitc-init if we can get the gitc config,
and hides it otherwise.
Change-Id: I82830b0b07c311e8c74397ba79eb4c361f8b6fb5
diff --git a/subcmds/help.py b/subcmds/help.py
index 4aa3f86..ae5b8f0 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -19,7 +19,8 @@
from formatter import AbstractFormatter, DumbWriter
from color import Coloring
-from command import PagedCommand, MirrorSafeCommand
+from command import PagedCommand, MirrorSafeCommand, RequiresGitcCommand
+import gitc_utils
class Help(PagedCommand, MirrorSafeCommand):
common = False
@@ -54,9 +55,17 @@
def _PrintCommonCommands(self):
print('usage: repo COMMAND [ARGS]')
print('The most commonly used repo commands are:')
+
+ def gitc_supported(cmd):
+ if not isinstance(cmd, RequiresGitcCommand):
+ return True
+ if gitc_utils.get_gitc_manifest_dir():
+ return True
+ return False
+
commandNames = list(sorted([name
for name, command in self.commands.items()
- if command.common]))
+ if command.common and gitc_supported(command)]))
maxlen = 0
for name in commandNames: