-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathlf.js
executable file
·31 lines (29 loc) · 1.36 KB
/
lf.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
#! /usr/bin/env node
import { DefaultVer } from '#common/constants/question.const.js';
import { commonMode } from '#common/utils/cli-utils/commonMode.js';
import { willUse } from '#common/utils/etc/willUse.js';
import { easyFinderView } from '#common/view/finder.view.js';
import { aim } from '#resources/text/aim.js';
import { artFontLogo } from '#resources/text/art-font-logo.js';
import { description } from '#resources/text/description.js';
import { lfExamples } from '#resources/text/examples.js';
import { love } from '#resources/text/love.js';
import { program } from 'commander';
const version = process.env.VERSION ?? DefaultVer
program
.version(version)
.description(`${description}\n${artFontLogo}\n${aim}`)
.addHelpText('after', lfExamples + love)
.option('-e, --easy', 'Use easy mode.')
.option('-d, --directory <directory>', 'Set the question directory.')
.option('-l, --language [language]', 'Set/Get the code language of question.')
.option('-v, --ver', 'Check the version info and some extra info about leetcode-practice.')
.option('-u, --update', 'Check the version to determine whether to update to the latest one.')
.parse(process.argv)
const cmdArgs = program.args
const cmdOpts = program.opts()
// 通用参数执行
const baseDir = await commonMode(cmdOpts, easyFinderView)
await easyFinderView(baseDir)
willUse(cmdArgs, baseDir)
process.exit(0)