MCPcopy Create free account
hub / github.com/Serverless-Devs/Serverless-Devs / specifyServiceHelp

Function specifyServiceHelp

src/command/cli/v1.ts:119–145  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

117};
118
119async function specifyServiceHelp(filePath: string) {
120 const publishYamlInfor = await core.getYamlContent(filePath);
121 logger.write(`\n ${emoji('🚀')} ${publishYamlInfor['Name']}@${publishYamlInfor['Version']}: ${publishYamlInfor['Description']}\n`);
122 const commands = publishYamlInfor['Commands'];
123 if (commands) {
124 const maxLength = core.publishHelp.maxLen(commands);
125 let tmp = [];
126 const newObj = {};
127 for (const key in commands) {
128 const ele = commands[key];
129 isPlainObject(ele) ? tmp.push(core.publishHelp.helpInfo(ele, chalk.underline(chalk.bold(key)), maxLength, 4)) : (newObj[key] = ele);
130 }
131 tmp.length > 0 && logger.write(tmp.join('\n'));
132 if (!isEmpty(newObj)) {
133 for (const key in newObj) {
134 logger.write(` ${getTempCommandStr(key, maxLength)} ${newObj[key]}`);
135 }
136 logger.write('');
137 }
138 logger.write(publishYamlInfor['HomePage'] ? ` ${emoji('🧭')} ${core.makeUnderLine('More information: ' + publishYamlInfor['HomePage'])} ` + '\n' : '');
139 }
140 function getTempCommandStr(commands: string, length: number) {
141 const commandsLength = commands.length;
142 const tempArray = new Array(length - commandsLength).fill(' ');
143 return `${commands}${tempArray.join('')} : `;
144 }
145}
146
147export default v1;

Callers 1

doActionFunction · 0.85

Calls 1

getTempCommandStrFunction · 0.85

Tested by

no test coverage detected