WIP
This commit is contained in:
+10
-6
@@ -29,16 +29,15 @@ const generateHelp = ({ cmds, prefixCmd = "", prefixDesc = "" }) => {
|
||||
const commandLabel = cmd?.postCommand ? `${cmd?.key} ${cmd?.postCommand}` : cmd?.key
|
||||
if (cmd?.mainTitle) {
|
||||
italicEmphasizeGreen(cmd?.mainTitle)
|
||||
if (cmd?.subCommands?.length > 0) {
|
||||
if (cmd?.keys?.length > 0) {
|
||||
generateHelp({
|
||||
cmds: cmd?.subCommands || [],
|
||||
cmds: cmd?.keys || [],
|
||||
prefixCmd: cmd?.key,
|
||||
prefixDesc: cmd?.desc,
|
||||
})
|
||||
} else {
|
||||
emphasizeText(formatCommandSection(commandLabel, prefixCmd, cmd?.maxLength), formatHelpSection(cmd?.desc, prefixDesc))
|
||||
}
|
||||
console.groupEnd()
|
||||
} else {
|
||||
emphasizeText(formatCommandSection(commandLabel, prefixCmd, cmd?.maxLength), formatHelpSection(cmd?.desc, prefixDesc))
|
||||
}
|
||||
@@ -46,10 +45,14 @@ const generateHelp = ({ cmds, prefixCmd = "", prefixDesc = "" }) => {
|
||||
}
|
||||
|
||||
const cliHelp = async () => {
|
||||
if (process.env.JJ_CLI_ARG_2 == "auto-completion") {
|
||||
|
||||
// const aaa = getJJConfigByKeyChain(`commands`)
|
||||
console.log(`add this to .zshrc: "source ${process.env.JJ_SOURCE_DIR}/bashUtils/auto-completion.sh" `)
|
||||
return
|
||||
}
|
||||
console.log(chalk.blue.italic.bold("Usage: jj <COMMAND>"))
|
||||
console.log("")
|
||||
console.group(chalk.blue.italic.bold("Commands:"))
|
||||
console.log("")
|
||||
|
||||
cliConfig.commandsObject = getJJConfigByKeyChain(`commands`)
|
||||
cliConfig.commandList = Object.keys(cliConfig.commandsObject).map((cmdKey) => ({
|
||||
@@ -61,7 +64,8 @@ const cliHelp = async () => {
|
||||
cmds: cliConfig.commandList,
|
||||
})
|
||||
|
||||
console.groupEnd()
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
export default cliHelp;
|
||||
|
||||
Reference in New Issue
Block a user