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
This commit is contained in:
Dan Willemsen
2015-08-31 15:45:06 -07:00
parent 2487cb7b2c
commit 9ff2ece6ab
5 changed files with 39 additions and 5 deletions

View File

@ -18,10 +18,11 @@ import os
import sys
import gitc_utils
from command import RequiresGitcCommand
from subcmds import init
class GitcInit(init.Init):
class GitcInit(init.Init, RequiresGitcCommand):
common = True
helpSummary = "Initialize a GITC Client."
helpUsage = """

View File

@ -19,7 +19,8 @@ import sys
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 @@ Displays detailed usage information about a command.
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: