diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 2b34450..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -open_collective: docsify diff --git a/README.md b/README.md index 577100d..23957a8 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,12 @@ npm i docsify-cli -g Use `init` to generate your docs. ```shell -docsify init [--local false] [--theme vue] [--plugins false] +docsify init [path] [--local false] [--theme vue] [--plugins false] -# docsify i [-l false] [-t vue] [--plugins false] +# docsify i [path] [-l false] [-t vue] [--plugins false] ``` -`` defaults to the current directory. Use relative paths like `./docs` (or `docs`). +`[path]` defaults to the current directory. Use relative paths like `./docs` (or `docs`). - `--local` option: - Shorthand: `-l` @@ -78,9 +78,9 @@ docsify init [--local false] [--theme vue] [--plugins false] Run a server on `localhost` with livereload. ```shell -docsify serve [--open false] [--port 3000] +docsify serve [path] [--open false] [--port 3000] -# docsify s [-o false] [-p 3000] +# docsify s [path] [-o false] [-p 3000] ``` - `--open` option: @@ -99,9 +99,9 @@ docsify serve [--open false] [--port 3000] Docsify's generators. ```shell -docsify generate [--sidebar _sidebar.md] +docsify generate [path] [--sidebar _sidebar.md] -# docsify g [-s _sidebar.md] +# docsify g [path] [-s _sidebar.md] ``` - `--sidebar` option: diff --git a/docs/README.md b/docs/README.md index d4772b7..32e8231 100644 --- a/docs/README.md +++ b/docs/README.md @@ -35,12 +35,12 @@ npm i docsify-cli -g Use `init` to generate your docs. ```shell -docsify init [--local false] [--theme vue] [--plugins false] +docsify init [path] [--local false] [--theme vue] [--plugins false] -# docsify i [-l false] [-t vue] [--plugins false] +# docsify i [path] [-l false] [-t vue] [--plugins false] ``` -`` defaults to the current directory. Use relative paths like `./docs` (or `docs`). +`[path]` defaults to the current directory. Use relative paths like `./docs` (or `docs`). - `--local` option: - Shorthand: `-l` @@ -63,9 +63,9 @@ docsify init [--local false] [--theme vue] [--plugins false] Run a server on `localhost` with livereload. ```shell -docsify serve [--open false] [--port 3000] +docsify serve [path] [--open false] [--port 3000] -# docsify s [-o false] [-p 3000] +# docsify s [path] [-o false] [-p 3000] ``` - `--open` option: @@ -84,9 +84,9 @@ docsify serve [--open false] [--port 3000] Docsify's generators. ```shell -docsify generate [--sidebar _sidebar.md] +docsify generate [path] [--sidebar _sidebar.md] -# docsify g [-s _sidebar.md] +# docsify g [path] [-s _sidebar.md] ``` - `--sidebar` option: diff --git a/e2e/cli.test.js.md b/e2e/cli.test.js.md index 1b025b9..007f219 100644 --- a/e2e/cli.test.js.md +++ b/e2e/cli.test.js.md @@ -4,17 +4,17 @@ The actual snapshot is saved in `cli.test.js.snap`. Generated by [AVA](https://avajs.dev). -## rejects promise due to error on passing in an unknown command +## shows up help message without any args > Snapshot 1 - `Usage: docsify ␊ + `Usage: docsify [path]␊ ␊ Commands:␊ docsify init [path] Creates new docs [aliases: i]␊ docsify serve [path] Run local server to preview site. [aliases: s]␊ - docsify start Server for SSR␊ - docsify generate Docsify's generators [aliases: g]␊ + docsify start [path] Server for SSR␊ + docsify generate [path] Docsify's generators [aliases: g]␊ ␊ Global Options␊ --help, -h Show help [boolean]␊ @@ -27,19 +27,19 @@ Generated by [AVA](https://avajs.dev). Development:␊ https://github.com/docsifyjs/docsify-cli/blob/master/CONTRIBUTING.md␊ ␊ - Unknown argument: junkcmd` + [ERROR] 0 arguments passed. Please specify a command` -## shows help with --help flag +## shows help with -h flag > Snapshot 1 - `Usage: docsify ␊ + `Usage: docsify [path]␊ ␊ Commands:␊ docsify init [path] Creates new docs [aliases: i]␊ docsify serve [path] Run local server to preview site. [aliases: s]␊ - docsify start Server for SSR␊ - docsify generate Docsify's generators [aliases: g]␊ + docsify start [path] Server for SSR␊ + docsify generate [path] Docsify's generators [aliases: g]␊ ␊ Global Options␊ --help, -h Show help [boolean]␊ @@ -52,17 +52,17 @@ Generated by [AVA](https://avajs.dev). Development:␊ https://github.com/docsifyjs/docsify-cli/blob/master/CONTRIBUTING.md` -## shows help with -h flag +## shows help with --help flag > Snapshot 1 - `Usage: docsify ␊ + `Usage: docsify [path]␊ ␊ Commands:␊ docsify init [path] Creates new docs [aliases: i]␊ docsify serve [path] Run local server to preview site. [aliases: s]␊ - docsify start Server for SSR␊ - docsify generate Docsify's generators [aliases: g]␊ + docsify start [path] Server for SSR␊ + docsify generate [path] Docsify's generators [aliases: g]␊ ␊ Global Options␊ --help, -h Show help [boolean]␊ @@ -75,17 +75,35 @@ Generated by [AVA](https://avajs.dev). Development:␊ https://github.com/docsifyjs/docsify-cli/blob/master/CONTRIBUTING.md` -## shows up help message without any args +## shows version information with -v flag + +> Snapshot 1 + + `␊ + docsify-cli version:␊ + 4.4.4␊ + ` + +## shows version information with --version flag + +> Snapshot 1 + + `␊ + docsify-cli version:␊ + 4.4.4␊ + ` + +## rejects promise due to error on passing in an unknown command > Snapshot 1 - `Usage: docsify ␊ + `Usage: docsify [path]␊ ␊ Commands:␊ docsify init [path] Creates new docs [aliases: i]␊ docsify serve [path] Run local server to preview site. [aliases: s]␊ - docsify start Server for SSR␊ - docsify generate Docsify's generators [aliases: g]␊ + docsify start [path] Server for SSR␊ + docsify generate [path] Docsify's generators [aliases: g]␊ ␊ Global Options␊ --help, -h Show help [boolean]␊ @@ -98,22 +116,4 @@ Generated by [AVA](https://avajs.dev). Development:␊ https://github.com/docsifyjs/docsify-cli/blob/master/CONTRIBUTING.md␊ ␊ - [ERROR] 0 arguments passed. Please specify a command` - -## shows version information with --version flag - -> Snapshot 1 - - `␊ - docsify-cli version:␊ - 4.4.4␊ - ` - -## shows version information with -v flag - -> Snapshot 1 - - `␊ - docsify-cli version:␊ - 4.4.4␊ - ` + Unknown argument: junkcmd` diff --git a/e2e/cli.test.js.snap b/e2e/cli.test.js.snap index 02e125f..6cb284e 100644 Binary files a/e2e/cli.test.js.snap and b/e2e/cli.test.js.snap differ diff --git a/lib/cli.js b/lib/cli.js index 11de63d..a0a7651 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -18,7 +18,7 @@ require('yargs') .demandCommand(1, chalk.red('[ERROR] 0 arguments passed. Please specify a command')) .strict() .recommendCommands() - .usage(chalk.bold(y18n.__('usage') + ': docsify ')) + .usage(chalk.bold(y18n.__('usage') + ': docsify [path]')) .command({ command: 'init [path]', aliases: 'i', @@ -94,7 +94,7 @@ require('yargs') handler: argv => run.serve(argv.path, argv.open, argv.port, argv.P, argv.i) }) .command({ - command: 'start ', + command: 'start [path]', desc: chalk.gray(y18n.__('start')), builder: yargs => yargs.options({ @@ -118,7 +118,7 @@ require('yargs') handler: argv => run.start(argv.path, argv.config, argv.port) }) .command({ - command: 'generate ', + command: 'generate [path]', aliases: 'g', desc: chalk.gray(y18n.__('generate')), builder: yargs => diff --git a/lib/commands/generate.js b/lib/commands/generate.js index eb43fbc..0ab850c 100644 --- a/lib/commands/generate.js +++ b/lib/commands/generate.js @@ -7,8 +7,7 @@ const path = require('path') const logger = require('../util/logger') const ignoreFiles = ['_navbar', '_coverpage', '_sidebar'] -// eslint-disable-next-line -module.exports = function (path = '', sidebar) { +module.exports = function (path, sidebar) { const cwdPath = cwd(path || '.') if (exists(cwdPath)) { diff --git a/tools/locales/en.json b/tools/locales/en.json index 9488e4f..cc742fb 100644 --- a/tools/locales/en.json +++ b/tools/locales/en.json @@ -15,5 +15,6 @@ "generate.sidebar": "Generate sidebar file", "livereload.port": "livereload Listen port.", "usage": "Usage", - "version": "Show version number" + "version": "Show version number", + "gen.sidebar": "Generate sidebar" } diff --git a/tools/locales/zh.json b/tools/locales/zh.json index 162179e..7deab30 100644 --- a/tools/locales/zh.json +++ b/tools/locales/zh.json @@ -15,5 +15,6 @@ "generate.sidebar": "生成侧边栏文件", "livereload.port": "设置 livereload 端口", "usage": "例子", - "version": "当前版本号" + "version": "当前版本号", + "gen.sidebar": "生成侧边栏" }