forked from khalillechelt/blog-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli.js
executable file
·54 lines (45 loc) · 914 Bytes
/
cli.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
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const blogCli = require('.');
const options = {
flags: {
path: {
type: 'string',
alias: 'p'
},
publish: {
type: 'boolean',
alias: 'pub',
default: false
},
editor: {
type: 'string',
alias: 'e'
}
}
};
const cli = meow(
`
Usage
$ blog [slug]
Options
--help
--path ~/path/to/posts [Default: .]
--editor 'visual studio code' [Default: 'ia writer']
--publish [Default: true]
Examples
$ blog --path ~/my-blog/posts
Saved the path \`~/my-blog/posts\` for your blog posts
$ blog --editor 'visual studio code'
Saved visual studio code as your editor
$ blog my-cool-post
Created your new post at
/Users/username/my-blog/posts/2019-01-17-my-cool-post.md
and openening it in your editor
$ blog --publish
Your changes have been pushed
`,
options
);
blogCli(cli.input[0], cli.flags);