def getRow(shortcut, explanation, commandsWithOptions, pathToFunctions): # Do not print aliases that just run the command as sudo. if explanation.startswith("Run ") and explanation.endswith(" as super user."): return functionName = util.descriptionToCamelCase(explanation) lineStart, lineEnd = getFunctionLineNumber(functionName) functionBody = getFunctionBody(lineStart, commandsWithOptions).replace("`", "") link = getLink(lineStart, lineEnd, pathToFunctions) if len(functionBody) >= LENGTH_OF_CODE_SNIPPET or lineEnd - lineStart > 2: runs = "`" + functionBody + "`[**`...`**](" + link + ")" else: runs = "`" + functionBody + "`" return "**" + shortcut + "** | " + runs + " | " + explanation + "\n"
def getRow(shortcut, explanation, commandsWithOptions, pathToFunctions): # Do not print aliases that just run the command as sudo. if explanation.startswith("Run ") and \ explanation.endswith(" as super user."): return functionName = util.descriptionToCamelCase(explanation) lineStart, lineEnd = getFunctionLineNumber(functionName) functionBody = getFunctionBody(lineStart, commandsWithOptions).replace('`', '') link = getLink(lineStart, lineEnd, pathToFunctions) if len(functionBody) >= LENGTH_OF_CODE_SNIPPET \ or lineEnd - lineStart > 2: runs = "`" + functionBody + "`[**`...`**](" + link + ")" else: runs = "`" + functionBody + "`" return "**" + shortcut + "** | " + runs + " | " + explanation + "\n"
def processAlias(existingCommands, completions, tokens): fun = "" shortcuts = tokens[0] shortcutTokens = shortcuts.split(',') for shortcut in shortcutTokens: shortcut = shortcut.strip() command = util.descriptionToCamelCase(tokens[1]) if not shortcut: continue if shortcut in existingCommands or shortcut == '?': fun += "alias " + shortcut + "='" + command + "'\n\n" else: fun += shortcut + "() {\n" fun += " " + command + " \"$@\"\n" fun += "}\n" if command in completions: fun += completions[command] + " " + shortcut + "\n" fun += "\n" return fun
def processAlias(existingCommands, completions, tokens): fun = "" shortcuts = tokens[0] shortcutTokens = shortcuts.split(',') for shortcut in shortcutTokens: shortcut = shortcut.strip() command = util.descriptionToCamelCase(tokens[1]) if not shortcut: continue if shortcut in existingCommands or shortcut == '?': fun += "alias "+shortcut+"='"+command+"'\n\n" else: fun += shortcut+"() {\n" fun += " "+command+" \"$@\"\n" fun += "}\n" if command in completions: fun += completions[command]+" "+shortcut+"\n" fun += "\n" return fun