Skip to content

docs: refine cli documentation #2151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions packages/docs/docs/api/cli.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,74 @@
---
sidebarDepth: 3
---

# Command-line Interface

There are currently four cli commands in VuePress: [build](#build), [dev](#dev), [eject](#eject) and [info](#info).

If they are not enough for you, you can also create [your own commands](#more-commands).

## Usage

```bash
vuepress <command> targetDir [options]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removing targetDir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vuepress info command does not require targetDir

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the other commands miss targetDir

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's the difference between vuepress --help and vuepress dev --help?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, some people won't realize that they have to pass targetDir at first glance. In this case, how about rewriting Usage in each section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing it again, I think I'm not making too much improvement 😅Really sorry about that, will do more research next time. Does it look a bit better now?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

vuepress <command> [options]
```

## build
You can always add `--help` flag to get to know more about cli commands.

## Commands

### build

Build dir as a static site.

### -p, --port `<port>`
#### -p, --port `<port>`

See [port](../config/README.md#port).

### -t, --temp `<temp>`
#### -t, --temp `<temp>`

See [temp](../config/README.md#temp).

### -c, --cache `[cache]`
### --no-cache
#### -c, --cache `[cache]`

#### --no-cache

See [cache](../config/README.md#cache).

### --dest `<dest>`
#### -d, --dest `<dest>`

See [dest](../config/README.md#dest).

### --debug
#### --debug

Start development server in debug mode.

### --silent
#### --silent

Start development server in silent mode.

## dev
### dev

Start a development server. All options from `vuepress build` are available. And there are several options specifically for dev:

### --host `<host>`
#### --host `<host>`

See [host](../config/README.md#host).

### --open
#### --open

Open browser when ready.

### --no-clear-screen
#### --no-clear-screen

Do not clear screen when dev server is ready. Note that dev server will not clear screen if you start it in debug mode.

## eject
### eject

Copy the default theme into `.vuepress/theme` for customization.

## info
### info

Shows debugging information about the local environment.

Expand Down
2 changes: 1 addition & 1 deletion packages/vuepress/lib/checkEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const { chalk, semver } = require('@vuepress/shared-utils')

/**
* Expose handleUnknownCommand function.
* Check if Node version meets VuePress requirement.
*/

module.exports = function checkEnv (pkg) {
Expand Down