-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·92 lines (86 loc) · 2.94 KB
/
index.js
File metadata and controls
executable file
·92 lines (86 loc) · 2.94 KB
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
#!/usr/bin/env node
const chalk = require('chalk');
const { hideBin } = require('yargs/helpers')
/**
* account create
* account view details
* account view usage
* account verification send
* account verify
* account username remind
* account password forgot
* account password change
*/
const yargs = require('yargs/yargs')(hideBin(process.argv))
.scriptName("clicksend")
.commandDir('commands')
.usage(
'\n'
+ chalk.bold(chalk.yellow('ClickSend Command Line Interface'))
+ '\n'
+ '\n'
+ chalk.bold('Usage: $0 <command> [options]'
+ '\n'
+ '\n'
+ 'To get help on a specific command, use \'clicksend <command> --help\'\n'
))
.demandCommand()
.option('csuser', {
describe: 'Your ClickSend user name.\n\nIf not provided through the command line, the tool will attempt to read this value from the environment varialble CLICKSEND_USER.\n',
requiresArg: true,
demandOption: false,
type: 'string',
group: 'ClickSend Connection Options:'
})
.option('cstoken', {
describe: 'Your access token you generated for this tool.\n\nIf not provided through the command line, the tool will attempt to read this value from the environment varialble CLICKSEND_TOKEN.\n',
requiresArg: true,
demandOption: false,
type: 'string',
group: 'ClickSend Connection Options:'
})
.option('cshost', {
desc : 'The ClickSend host to which you wish to connect.\n\n',
default : 'rest.clicksend.com',
type : 'string',
group: 'ClickSend Connection Options:',
hidden : true
})
.option('debug', {
alias: 'D',
describe: 'Debugging level from 0 to 5. Where 0 is "off" and 5 is every possible message.\n',
type: 'number',
default : 0,
hidden: true,
group: 'Debug Options:'
})
.option( 'output', {
alias : 'O',
describe : 'Where the output from this command will be sent.\n\nYou can specify multiple destinations. If you specify \'none\' as an option, it will override any other output directives.\n',
type : 'array',
default : 'console',
choices : [ 'console', 'file', 'none', 'debug', 'error' ],
group: 'Output Options:',
hidden : true
})
.option( 'format', {
alias : 'F',
desc : 'How to format the output\n\nNot thata \'object\' format does not work well being written to files and data written using this format is subject to data trucation in all cases, but it looks cool.\n',
default : 'pretty',
choices : ['pretty', 'raw', 'object' ],
group: 'Output Options:',
hidden : true
})
.option( 'file', {
desc : 'When writing output to a file, this is the file name to which to write. If no directory is specified, the file will be created in the current directory.\n',
default : 'clicksend-output.json',
group : 'Output Options:',
hidden : true
})
.option( 'version', {
desc : 'Show the version number',
hidden : true
})
.help( "help")
;
yargs.wrap(Math.min(120,yargs.terminalWidth())).parse();