-
Notifications
You must be signed in to change notification settings - Fork 3
/
smar-auth.js
33 lines (30 loc) · 1000 Bytes
/
smar-auth.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
#!/usr/bin/env node
const auth = require('./lib/auth.js');
const program = require('commander');
program
.command('login')
.description('Login through Smartsheet OAuth')
.action(function() {
auth.login();
});
program
.command('logout')
// options arent getting passed corrrectly with the way auth.js is structured
.description('Removes your Smartsheet access token.')
.action(function() {
auth.logout();
});
program
.command('manual')
.option('--token [accesstoken]', 'Your manually generated Smartsheet Access Token')
.action(function() {
const info = program.args[program.args.length-1];
if (!info.token) {
console.error('To manually auth you need to provide your Smartsheet Access Token for --token');
process.exit(1);
}
let accessToken = info.token;
auth.login(accessToken);
});
program
.parse(process.argv);