Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ npm i docsify-cli -g
Use `init` to generate your docs.

```shell
docsify init <path> [--local false] [--theme vue] [--plugins false]
docsify init [path] [--local false] [--theme vue] [--plugins false]

# docsify i <path> [-l false] [-t vue] [--plugins false]
# docsify i [path] [-l false] [-t vue] [--plugins false]
```

`<path>` 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`
Expand All @@ -78,9 +78,9 @@ docsify init <path> [--local false] [--theme vue] [--plugins false]
Run a server on `localhost` with livereload.

```shell
docsify serve <path> [--open false] [--port 3000]
docsify serve [path] [--open false] [--port 3000]

# docsify s <path> [-o false] [-p 3000]
# docsify s [path] [-o false] [-p 3000]
```

- `--open` option:
Expand All @@ -99,9 +99,9 @@ docsify serve <path> [--open false] [--port 3000]
Docsify's generators.

```shell
docsify generate <path> [--sidebar _sidebar.md]
docsify generate [path] [--sidebar _sidebar.md]

# docsify g <path> [-s _sidebar.md]
# docsify g [path] [-s _sidebar.md]
```

- `--sidebar` option:
Expand Down
14 changes: 7 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ npm i docsify-cli -g
Use `init` to generate your docs.

```shell
docsify init <path> [--local false] [--theme vue] [--plugins false]
docsify init [path] [--local false] [--theme vue] [--plugins false]

# docsify i <path> [-l false] [-t vue] [--plugins false]
# docsify i [path] [-l false] [-t vue] [--plugins false]
```

`<path>` 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`
Expand All @@ -63,9 +63,9 @@ docsify init <path> [--local false] [--theme vue] [--plugins false]
Run a server on `localhost` with livereload.

```shell
docsify serve <path> [--open false] [--port 3000]
docsify serve [path] [--open false] [--port 3000]

# docsify s <path> [-o false] [-p 3000]
# docsify s [path] [-o false] [-p 3000]
```

- `--open` option:
Expand All @@ -84,9 +84,9 @@ docsify serve <path> [--open false] [--port 3000]
Docsify's generators.

```shell
docsify generate <path> [--sidebar _sidebar.md]
docsify generate [path] [--sidebar _sidebar.md]

# docsify g <path> [-s _sidebar.md]
# docsify g [path] [-s _sidebar.md]
```

- `--sidebar` option:
Expand Down
72 changes: 36 additions & 36 deletions e2e/cli.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init|serve> <path>
`Usage: docsify <init|serve> [path]
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start <path> Server for SSR␊
docsify generate <path> 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]␊
Expand All @@ -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 <init|serve> <path>
`Usage: docsify <init|serve> [path]
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start <path> Server for SSR␊
docsify generate <path> 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]␊
Expand All @@ -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 <init|serve> <path>
`Usage: docsify <init|serve> [path]
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start <path> Server for SSR␊
docsify generate <path> 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]␊
Expand All @@ -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 <init|serve> <path>
`Usage: docsify <init|serve> [path]
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start <path> Server for SSR␊
docsify generate <path> 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]␊
Expand All @@ -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`
Binary file modified e2e/cli.test.js.snap
Binary file not shown.
6 changes: 3 additions & 3 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init|serve> <path>'))
.usage(chalk.bold(y18n.__('usage') + ': docsify <init|serve> [path]'))
.command({
command: 'init [path]',
aliases: 'i',
Expand Down Expand Up @@ -94,7 +94,7 @@ require('yargs')
handler: argv => run.serve(argv.path, argv.open, argv.port, argv.P, argv.i)
})
.command({
command: 'start <path>',
command: 'start [path]',
desc: chalk.gray(y18n.__('start')),
builder: yargs =>
yargs.options({
Expand All @@ -118,7 +118,7 @@ require('yargs')
handler: argv => run.start(argv.path, argv.config, argv.port)
})
.command({
command: 'generate <path>',
command: 'generate [path]',
aliases: 'g',
desc: chalk.gray(y18n.__('generate')),
builder: yargs =>
Expand Down
3 changes: 1 addition & 2 deletions lib/commands/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 2 additions & 1 deletion tools/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
3 changes: 2 additions & 1 deletion tools/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"generate.sidebar": "生成侧边栏文件",
"livereload.port": "设置 livereload 端口",
"usage": "例子",
"version": "当前版本号"
"version": "当前版本号",
"gen.sidebar": "生成侧边栏"
}