-
Notifications
You must be signed in to change notification settings - Fork 3
/
smar-attachments.js
43 lines (38 loc) · 1.51 KB
/
smar-attachments.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
#!/usr/bin/env node
const attachments = require('./lib/attachments.js');
var program = require('commander');
program
.command('list')
.option('--sheet-id [id]', 'This is the id of your sheet')
.action(function () {
const info = program.args[program.args.length-1];
attachments.listAttachments(info.sheetId);
});
program
.command('get')
.option('--sheet-id [id]', 'This is the id of your sheet')
.option('--attachment-id [attachmentId]', 'This is the id of the attachment you want')
.action(function () {
const info = program.args[program.args.length-1];
attachments.getAttachment(info.sheetId, info.attachmentId);
})
program
.command('upload')
.option('--sheet-id [id]', 'This is the id of your sheet')
.option('--comment-id [id]', 'This is the id of your comment')
.option('--row-id [id]', 'This is the id of your row')
.option('--file [file]', 'This is the file you wish to upload')
.action(function () {
const info = program.args[program.args.length-1];
attachments.uploadAttachment(info.sheetId, info.commentId, info.rowId, info.file);
})
program
.command('delete')
.option('--sheet-id [id]', 'This is the id of your sheet')
.option('--attachment-id [attachmentId]', 'This is the id of the attachment you want to delete')
.action(function () {
const info = program.args[program.args.length-1];
attachments.deleteAttachment(info.sheetId, info.attachmentId);
})
program
.parse(process.argv);