forked from jhfgloria/bloggista
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
executable file
·31 lines (23 loc) · 1.06 KB
/
index.ts
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
#!/usr/bin/env node
import { Command } from "commander";
import * as Package from "./package.json";
import { buildCommand } from "./src/build-command";
import { createPostCommand } from "./src/create-post-command";
import { initCommand } from "./src/init-command";
const program = new Command();
program.name('bloggista')
.description('Bloggista provides you a CLI to create and manage your blog')
.version(Package.version);
program.command('init')
.argument('<name>', 'Name of the blog folder (can\'t contain spaces)')
.description('Creates the blog structure into given folder name')
.action(initCommand);
program.command('post')
.argument('<name>', 'Name of the blog post (can\'t contain spaces)')
.option('-p, --path <filePath>')
.description('Creates a blog post under a folder if one is given')
.action((name, { path }) => createPostCommand(name, path));
program.command('build')
.description('Builds the entire blog structure into the dist folder')
.action(buildCommand);
program.parse();