-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·33 lines (29 loc) · 949 Bytes
/
index.js
File metadata and controls
executable file
·33 lines (29 loc) · 949 Bytes
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 { program } = require('commander');
const imgen = require('./libs/imgen');
const webopen = require('./libs/webopen');
// 版本号
program.version('1.0.1');
// img generate
// imgen -s 100x200 -t png -f
program.command('imgen')
.description('generate img by custom size')
.requiredOption('-s, --size <size>', 'custom size')
.option('-t, --type <type>', 'generate img type', 'jpg')
.option('-f, --force', 'force generate although img exist', false)
.action(({ size, type, force }) => {
imgen(size, type, force);
});
// web open
// 直接打开 webopen https://baidu.com
// 设置别名 webopen alias baidu https://www.baidu.com/s?wd=${keyword}
// 别名打开 webopen baidu "今天吃什么"
// 获取别名 webopen alias baidu
program.command('webopen')
.description('open url quickly')
.arguments('<args...>')
.action(args => {
webopen(args);
});
// parse args
program.parse(process.argv);