Skip to content

Commit

Permalink
docs(unstable): Update script documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 18, 2023
1 parent a365a69 commit b3bc676
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions src/doc/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -1191,13 +1191,12 @@ fn main() {}
```

A user may optionally specify a manifest in a `cargo` code fence in a module-level comment, like:
```rust
````rust
#!/usr/bin/env -S cargo +nightly -Zscript

//! ```cargo
//! [dependencies]
//! clap = { version = "4.2", features = ["derive"] }
//! ```
```cargo
[dependencies]
clap = { version = "4.2", features = ["derive"] }
```

use clap::Parser;

Expand All @@ -1212,7 +1211,7 @@ fn main() {
let args = Args::parse();
println!("{:?}", args);
}
```
````

### Single-file packages

Expand All @@ -1225,22 +1224,8 @@ Single-file packages may be selected via `--manifest-path`, like
`cargo test --manifest-path foo.rs`. Unlike `Cargo.toml`, these files cannot be auto-discovered.

A single-file package may contain an embedded manifest. An embedded manifest
is stored using `TOML` in a markdown code-fence with `cargo` at the start of the
infostring inside a target-level doc-comment. It is an error to have multiple
`cargo` code fences in the target-level doc-comment. We can relax this later,
either merging the code fences or ignoring later code fences.

Supported forms of embedded manifest are:
``````rust
//! ```cargo
//! ```
``````
``````rust
/*!
* ```cargo
* ```
*/
``````
is stored using `TOML` in rust "frontmatter", a markdown code-fence with `cargo`
at the start of the infostring at the top of the file.

Inferred / defaulted manifest fields:
- `package.name = <slugified file stem>`
Expand Down

0 comments on commit b3bc676

Please sign in to comment.