-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathprogram.js
114 lines (96 loc) · 3.9 KB
/
program.js
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
102
103
104
105
106
107
108
109
110
111
112
113
114
var program = require('commander');
var actions = require('./module/actions.js');
var package = require('./package.json');
program
.version(package.version);
program
.command('connect <url> <apiKey>')
.description('Connect to server using API key for authentication.')
.action(actions.handleConnect);
program
.command('projects')
.description('Display projects.')
.action(actions.handleProjects);
program
.command('project <identifier>')
.description('Display project details.')
.action(actions.handleProject);
program
.command('update-project <identifier>')
.description('Update the specified project.')
.option('-d, --description <description>', 'Update description.')
.option('-p, --public <boolean>', 'Update visibility.')
.option('-P, --parent <id>', 'Update parent project.')
.action(actions.handleUpdateProject);
program
.command('create-project <name> <identifier>')
.description('Create a new project.')
.option('-d, --description <description>', 'Create with description.')
.option('-p, --public', 'Create public (default is private).')
.option('-P, --parent <id>', 'Create as child project.')
.action(actions.handleCreateProject);
program
.command('issues')
.description('Display issues.')
.option('-p, --project <project>', 'Only display issues for the specified project.')
.option('-P, --priority <priority>', 'Only display issues with specified priority.')
.option('-a, --assignee <assignee>', 'Only display issues for the specified assignee.')
.option('-s, --status <status>', 'Only display issues with the specified status.')
.option('-t, --tracker <tracker>', 'Only display issues for the specified tracker.')
.option('-m, --me', 'Only display issues assigned to me.')
.option('-o, --open', 'Only display open issues.')
.option('-c, --closed', 'Only display closed issues.')
.action(actions.handleIssues);
program
.command('issue <id>')
.description('Display issue details.')
.option('-H, --history', 'Include issue history (may increase loading time).')
.action(actions.handleIssue);
program
.command('update-issue <id>')
.description('Update the specified issue.')
.option('-P, --priority <priority>', 'Update the priority.')
.option('-a, --assignee <userId>', 'Update the assignee.')
.option('-s, --status <status>', 'Update the status.')
.option('-e, --estimated <estimatedHours>', 'Update the estimated hours.')
.option('-t, --tracker <tracker>', 'Update the tracker.')
.option('-S, --subject <subject>', 'Update the subject.')
.option('-d, --description <description>', 'Update the description.')
.action(actions.handleUpdateIssue);
program
.command('create-issue <project> <subject>')
.description('Create a new issue.')
.option('-P, --priority <priority>', 'Create with priority.')
.option('-a, --assignee <userId>', 'Create with assignee.')
.option('-s, --status <status>', 'Create with status.')
.option('-t, --tracker <tracker>', 'Create with tracker.')
.option('-e, --estimated <estimatedHours>', 'Create with estimated hours.')
.option('-d, --description <description>', 'Create with description.')
.action(actions.handleCreateIssue);
program
.command('statuses')
.description('Display available issue statuses.')
.action(actions.handleStatuses);
program
.command('trackers')
.description('Display available trackers.')
.action(actions.handleTrackers);
program
.command('priorities')
.description('Display available priorities.')
.action(actions.handlePriorities);
program
.command('users')
.description('Display users (requires admin priviliges).')
.action(actions.handleUsers);
program
.command('user <id>')
.description('Display user details (requires admin priviliges).')
.action(actions.handleUser);
program
.command('open <id>')
.description('Open issue in default browser.')
.action(actions.handleOpen);
program
.parse(process.argv);
if (!program.args.length) program.help();