-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
Β·52 lines (47 loc) Β· 1.61 KB
/
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
#!/usr/bin/env node
import { Command } from 'commander'
import chalk from 'chalk'
import {
createAction,
checkAction,
helpAction,
} from '../lib/actions.js'
import { importJson } from '../lib/utils.js'
const pkg = importJson('../package.json')
const program = new Command()
const logo = `
=============================================
βββββ ββ β ββ βββββ
ββ β ββ ββ β ββ βββ β
βββ ββ β β ββ β
β ββ β β ββ β
β β β ββ β β
β β
${chalk.italic(`${pkg.name} v${pkg.version}`)}
${chalk.italic(pkg.description)}
=============================================
`
const description = `${chalk.green(logo.replace(/^\n/g, ''))}
FixIt is a clean, elegant but advanced blog theme for Hugo
built with love by Lruihao and his friends.\n
Complete documentation is available at ${chalk.cyan('https://fixit.lruihao.cn/')}.`
// define commands
program
.command('create <project-name>')
.description('create a new FixIt project from a template')
.action(createAction)
program
.command('check')
.description('check the latest version of FixIt theme')
.action(checkAction)
program
.command('help <command>')
.description('display help for a specific command')
.action(helpAction)
// define cli
program
.usage('<command> [options]')
.description(description)
.version(`${pkg.name} v${pkg.version}`, '-v, --version')
.showHelpAfterError()
.parse(process.argv)