MCPcopy Index your code
hub / github.com/github/awesome-copilot / parseArgs

Function parseArgs

eng/create-skill.mjs:19–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19function parseArgs() {
20 const args = process.argv.slice(2);
21 const out = { name: undefined, description: undefined };
22
23 for (let i = 0; i < args.length; i++) {
24 const a = args[i];
25 if (a === "--name" || a === "-n") {
26 out.name = args[i + 1];
27 i++;
28 } else if (a.startsWith("--name=")) {
29 out.name = a.split("=")[1];
30 } else if (a === "--description" || a === "-d") {
31 out.description = args[i + 1];
32 i++;
33 } else if (a.startsWith("--description=")) {
34 out.description = a.split("=")[1];
35 } else if (!a.startsWith("-") && !out.name) {
36 out.name = a;
37 }
38 }
39
40 return out;
41}
42
43async function createSkillTemplate() {
44 try {

Callers 1

createSkillTemplateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected