mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-09-27 19:22:14 +08:00
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:
@@ -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 = """
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user