Skip to content
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

Update cli-reference.mdx #9895

Merged
merged 7 commits into from
Nov 14, 2024
Merged
Changes from all 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
48 changes: 43 additions & 5 deletions src/content/docs/en/reference/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Commands
add Add an integration.
build Build your project and write it to disk.
check Check your project for errors.
create-key Create a cryptography key
dev Start the development server.
docs Open documentation in your web browser.
info List info about your current Astro setup.
Expand All @@ -80,10 +81,47 @@ Global Flags
--verbose Enable verbose logging.
--silent Disable all logging.
--version Show the version number and exit.
--open Open the app in the browser on server start.
--help Show this help message.
```


You can add the `--help` flag after any command to get a list of all the flags for that command.

<PackageManagerTabs>
<Fragment slot="npm">
```shell
# get a list of all flags for the `dev` command
npm run dev -- --help
```
</Fragment>
<Fragment slot="pnpm">
```shell
# get a list of all flags for the `dev` command
pnpm dev --help
```
</Fragment>
<Fragment slot="yarn">
```shell
# get a list of all flags for the `dev` command
yarn dev --help
```
</Fragment>
</PackageManagerTabs>

The following message will display in your terminal:

```bash
astro dev [...flags]

Flags
--port Specify which port to run on. Defaults to 4321.
--host Listen on all addresses, including LAN and public addresses.
--host <custom-address> Expose on a network IP address at <custom-address>
--open Automatically open the app in the browser on server start
--force Clear the content layer cache, forcing a full rebuild.
--help (-h) See all available flags.
```

:::note
The extra `--` before any flag is necessary for `npm` to pass your flags to the `astro` command.
:::
Expand Down Expand Up @@ -436,6 +474,10 @@ Enables verbose logging, which is helpful when debugging an issue.

Enables silent logging, which will run the server without any console output.

### `--open`

Automatically opens the app in the browser on server start. Can be passed a full URL string (e.g. `--open http://example.com`) or a pathname (e.g. `--open /about`) to specify the URL to open.

## Global flags

Use these flags to get information about the `astro` CLI.
Expand All @@ -444,10 +486,6 @@ Use these flags to get information about the `astro` CLI.

Prints the Astro version number and exits.

### `--open`

Automatically opens the app in the browser on server start. Can be passed a full URL string (e.g. `--open http://example.com`) or a pathname (e.g. `--open /about`) to specify the URL to open.

### `--help`

Prints the help message and exits.
Expand Down
Loading