-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
113 lines (94 loc) · 2.97 KB
/
index.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
#!/usr/bin/env node
const program = require('commander');
const pkg = require(__dirname + '/package');
const lib = require(__dirname + '/lib');
program
.version(pkg.version)
.description(pkg.description);
program
.command('setup <client_id> <client_secret>')
.description('Setup utility. Do this before running `vimeo auth`')
.action((client_id, client_secret) => {
lib.getScript('setup')(client_id, client_secret)
});
program
.command('auth')
.description('Authenticate a new Vimeo account.')
.action (() => {
lib.getScript('auth')();
});
program
.command('use <nickname>')
.description('Use the specified user to authenticate requests.')
.action ((nickname) => {
lib.getScript('use')(nickname);
});
program
.command('users')
.description('List all authenticated users.')
.action(() => {
lib.getScript('users')();
});
program
.command('remove <nickname>')
.description('Removes specified user from the utility.')
.action((nickname) => {
lib.getScript('remove')(nickname);
});
program
.command('upload <path>')
.description('Upload a video.')
.option('-o, --open', 'Open video page after uploading')
.action((path, options) => {
lib.getScript('upload')(path, options);
});
program
.command('list <item_name>')
.description('List the specified items (videos, albums, followers, etc.)')
.action((item_name) => {
lib.getScript('list')(item_name);
});
program
.command('add <item_name>')
.description('Add a new item (album, group, channel, etc.)')
.option('-n, --name <name>', 'Specify a name')
.option('-d, --description <description>', 'Specify a description')
.option('-p, --privacy <privacy>', 'Specify a privacy')
.option('-P, --password <password>', 'Specify a password')
.option('-s, --sort <sort>', 'Specify a sort')
.option('-u, --user <user_id>', 'Specify a user ID')
.option('-v, --video <video_id>', 'Specify a video ID')
.action((item_name, options) => {
lib.getScript('add')(item_name, options);
});
// Alias for `add user -u <user_id>`
program
.command('follow <user_id>')
.description('Follow the specified user.')
.action((user_id) => {
var options = {
user: user_id
};
lib.getScript('add')('following', options);
});
// Alias for `add like -v <video_id>`
program
.command('like <video_id>')
.description('Like the specified video.')
.action((video_id) => {
var options = {
video: video_id
};
lib.getScript('add')('like', options);
});
// Alias for `add watchlater -v <video_id>`
program
.command('watchlater <video_id>')
.description('Add the specified video to your watch later queue.')
.action((video_id) => {
var options = {
video: video_id
};
lib.getScript('add')('watchlater', options);
});
program.parse(process.argv);