Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
docs: Add espm new docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Aug 28, 2023
1 parent e17ec0c commit 4fb6868
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
10 changes: 8 additions & 2 deletions crates/cli/src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ pub struct NewArgs {
#[arg(long, short = 'n', help = "Name of package.")]
pub name: Option<PackageName>,

#[arg(long, help = "Path to create the package in.")]
#[arg(
long,
help = "Path to create the package in, relative from working directory."
)]
pub to: Option<String>,

#[arg(long, help = "Skip all prompts and use default values.")]
#[arg(
long,
help = "Skip all interactive prompts and use default or provided values"
)]
pub yes: bool,
}

Expand Down
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@

## Commands

- [`espm build`](./commands/build.md) - Builds a package.
- [`espm new`](./commands/new.md) - Create a package.
- [`espm build`](./commands/build.md) - Build a package.
21 changes: 21 additions & 0 deletions docs/commands/new.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# `new`

The `espm new` command can be used to create and scaffold a new package. It will prompt you for a
package name, description, and other metadata, and will create a package with the necessary files,
like [`esp.toml`](../esp-toml.md).

```shell
espm new
espm new --name namespace/package --yes
```

> Prompt values can be autopopulated by passing options on the command line.
## Options

- `--to` - Destination to create the package in, relative from the current working directory.
Defaults to ".".
- `--name`, `-n` - Name of package.
- `--description`, `-d` - Description of package.
- `--keyword`, `-k` - List of keywords about the package. Can be provided multiple times.
- `--yes` - Skip all interactive prompts and use default or provided values.
10 changes: 9 additions & 1 deletion docs/package.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ in [TOML](https://toml.io/en/) and configures metadata about the package, like i
description, as well as dependencies (other packages) it requires, and also denotes the root of the
package.

Begin by creating the `esp.toml` file in your project, and insert the following initial content:
To easily create a package, run the [`espm new`](./commands/new.md) command and answer all the
prompts.

```shell
espm new
```

Otherwise, if you'd prefer to create a package manually, begin by creating the `esp.toml` file in
your project, and insert the following initial content:

```toml
[package]
Expand Down

0 comments on commit 4fb6868

Please sign in to comment.