-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·29 lines (22 loc) · 887 Bytes
/
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
#! /usr/bin/env node
const program = require('commander')
const setToken = require('./lib/set-token')
const createPlaylist = require('./lib/create-playlist')
const onFatalError = () => {
process.exitCode = 2
console.error('Oops! Something went wrong! :(')
}
const main = () => {
process.on('uncaughtException', onFatalError)
process.on('unhandledRejection', onFatalError)
program
.command('createPlaylist', { isDefault: true })
.description('<Default> Create private playlist for your spotify account. Note:Require \'recommendify settoken\' command before the first time you run.')
.action(() => createPlaylist())
program
.command('settoken')
.description('Login Spotify via authorization code flow (Refer: https://developer.spotify.com/documentation/general/guides/authorization-guide/).')
.action(() => setToken())
program.parse()
}
main()