Skip to content

Commit ba226ba

Browse files
committed
commit message: added "add snippet" feature.
Added its required fields in index.js. Does work in cli but does not take input yet
1 parent da16504 commit ba226ba

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.DS_Store

6 KB
Binary file not shown.

index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,19 @@ program
1818
.option('-f')
1919
.action(() =>{ console.log('Hello User, Welcome to the CLI');});
2020

21-
program.parse();
21+
program
22+
.name('add snippet <name>')
23+
.description('Add your code snippet in the language of your choice')
24+
.option('-l,--lang<language>','specify the programming language')
25+
.option('-d,--desc<description>','describe the code snippet')
26+
.option('-f,--file<path>','Path to the file containting the snippet')
27+
.option('--tags <tags>', 'Comma-separated tags', val => val.split(','))
28+
.action((name,option) =>{
29+
console.log('Name: ',name);
30+
console.log('Language: ', option.lang);
31+
console.log('Description: ', option.desc);
32+
console.log('File Path: ', option.file);
33+
console.log('Tags: ', option.tags);
34+
});
35+
36+
program.parse(process.argvs);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
"author": "",
1515
"license": "ISC",
1616
"dependencies": {
17-
"commander": "^14.0.0"
17+
"commander": "^14.0.0"
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)