-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·101 lines (90 loc) · 2.39 KB
/
cli.js
File metadata and controls
executable file
·101 lines (90 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#! /usr/bin/env node
const commander=require('commander');
const {prompt}=require('inquirer');
const {addProject,findProject,updateProject,deleteProject,listProjects}=require('./index');
const questions=[
{
type:'input',
name:'project',
message:'Enter the name of your Project (*)'
},
{
type:'input',
name:'description',
message:'Description for your Project (*)'
},
{
type:'input',
name:'status',
message:'Tell me the status of your Project (*)'
},
{
type:'input',
name:'technologies',
message:'Technologies (*)',
},
{
type:'input',
name:'githubRepo',
message:'Github Repository of your Project ()',
},
{
type:'input',
name:'localDirName',
message:'Local Directory of your Project (*)'
},
{
type:'input',
name:'author',
message:'Author (ashky23)',
default:'ashky23'
},
{
type:'input',
name:'others',
message:'Anything else you wish to mention regarding this project ()'
},
{
type:'input',
name:'futurePlans',
message:'Any future plans or goals that you wish to mention ()'
},
]
commander
.version('1.0.0')
.description('CLI tool to manage your projects locally for yourself')
//Function: to add the project entery to the database
commander
.command('add')
.alias('a')
.description('Add the Project')
.action(() => {
prompt(questions).then(answers=>addProject(answers));
});
//Function: to find the project entry by its name
commander
.command('find <name>')
.alias('f')
.description('Find a project by its name')
.action(name => findProject(name));
//Function: to update the existing project entry by its _id
commander
.command('update <_id>')
.alias('u')
.description('Update the project by its _id')
.action((_id)=>{
prompt(questions).then(answers=>updateProject(_id,answers));
})
//Function: to delete the existing project entry by its _id
commander
.command('delete <_id>')
.alias('d')
.description('Delete the project by its _id')
.action((_id)=>deleteProject(_id));
//Function: to list all the projects existing in the database
commander
.command('list')
.alias('ls')
.description('list all the projects')
.action(()=>listProjects());
commander.parse(process.argv);