Skip to content

Commit

Permalink
Merge branch 'master' of github.com:madolchepalooza/cargo-cn into mad…
Browse files Browse the repository at this point in the history
…olchepalooza-master
  • Loading branch information
aaranxu committed Feb 8, 2022
2 parents 72ba057 + 3f12de6 commit 1e58990
Show file tree
Hide file tree
Showing 141 changed files with 7,520 additions and 3,913 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Ignore built book
book/
semver-check/target
semver-check/Cargo.lock
mdman/target
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "cargo-doc-sync"]
path = cargo-doc-sync
url = https://github.com/madolchepalooza/cargo-doc-sync.git
9 changes: 2 additions & 7 deletions build-man.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@

set -e

cd "$(dirname "${BASH_SOURCE[0]}")"

OPTIONS="--url https://doc.rust-lang.org/cargo/commands/ \
--man rustc:1=https://doc.rust-lang.org/rustc/index.html \
--man rustdoc:1=https://doc.rust-lang.org/rustdoc/index.html"

cargo run --manifest-path=../../crates/mdman/Cargo.toml -- \
cargo run --manifest-path=./mdman/Cargo.toml -- \
-t md -o src/commands man/cargo*.md \
$OPTIONS

cargo run --manifest-path=../../crates/mdman/Cargo.toml -- \
cargo run --manifest-path=./mdman/Cargo.toml -- \
-t txt -o man/generated_txt man/cargo*.md \
$OPTIONS

cargo run --manifest-path=../../crates/mdman/Cargo.toml -- \
-t man -o ../etc/man man/cargo*.md \
$OPTIONS
1 change: 1 addition & 0 deletions cargo-doc-sync
Submodule cargo-doc-sync added at 060bcb
38 changes: 18 additions & 20 deletions man/cargo-bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ the two dashes (`--`) are passed to the benchmark binaries and thus to
_libtest_ (rustc's built in unit-test and micro-benchmarking framework). If
you are passing arguments to both Cargo and the binary, the ones after `--` go
to the binary, the ones before go to Cargo. For details about libtest's
arguments see the output of `cargo bench -- --help`. As an example, this will
run only the benchmark named `foo` (and skip other similarly named benchmarks
like `foobar`):
arguments see the output of `cargo bench -- --help` and check out the rustc
book's chapter on how tests work at
<https://doc.rust-lang.org/rustc/tests/index.html>.

As an example, this will run only the benchmark named `foo` (and skip other
similarly named benchmarks like `foobar`):

cargo bench -- foo --exact

Expand All @@ -43,6 +46,14 @@ function to handle running benchmarks.
> running benchmarks on the stable channel, such as
> [Criterion](https://crates.io/crates/criterion).
By default, `cargo bench` uses the [`bench` profile], which enables
optimizations and disables debugging information. If you need to debug a
benchmark, you can use the `--profile=dev` command-line option to switch to
the dev profile. You can then run the debug-enabled benchmark within a
debugger.

[`bench` profile]: ../reference/profiles.html#bench

## OPTIONS

### Benchmark Options
Expand Down Expand Up @@ -80,6 +91,10 @@ target.

{{> options-target-triple }}

{{> options-profile }}

{{> options-ignore-rust-version }}

{{/options}}

### Output Options
Expand Down Expand Up @@ -124,23 +139,6 @@ Rust test harness runs benchmarks serially in a single thread.
{{> options-jobs }}
{{/options}}

## PROFILES

Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
[the reference](../reference/profiles.html)
for more details.

Benchmarks are always built with the `bench` profile. Binary and lib targets
are built separately as benchmarks with the `bench` profile. Library targets
are built with the `release` profiles when linked to binaries and benchmarks.
Dependencies use the `release` profile.

If you need a debug build of a benchmark, try building it with
{{man "cargo-build" 1}} which will use the `test` profile which is by default
unoptimized and includes debug information. You can then run the debug-enabled
benchmark manually.

{{> section-environment }}

{{> section-exit-status }}
Expand Down
7 changes: 5 additions & 2 deletions man/cargo-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ they have `required-features` that are missing.

{{> options-release }}

{{> options-profile }}

{{> options-ignore-rust-version }}

{{/options}}

### Output Options
Expand Down Expand Up @@ -85,10 +89,9 @@ See <https://github.com/rust-lang/cargo/issues/5579> for more information.

{{#options}}
{{> options-jobs }}
{{> options-future-incompat }}
{{/options}}

{{> section-profiles }}

{{> section-environment }}

{{> section-exit-status }}
Expand Down
7 changes: 4 additions & 3 deletions man/cargo-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ they have `required-features` that are missing.

{{> options-release }}

{{> options-profile }}
{{> options-profile-legacy-check }}

{{> options-ignore-rust-version }}

{{/options}}

Expand Down Expand Up @@ -72,10 +74,9 @@ they have `required-features` that are missing.

{{#options}}
{{> options-jobs }}
{{> options-future-incompat }}
{{/options}}

{{> section-profiles }}

{{> section-environment }}

{{> section-exit-status }}
Expand Down
46 changes: 23 additions & 23 deletions man/cargo-clean.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
# cargo-clean(1)
{{*set actionverb="Clean"}}

## NAME
## 名称

cargo-clean - Remove generated artifacts
cargo-clean - 移除已生成的工件

## SYNOPSIS
## 用法

`cargo clean` [_options_]

## DESCRIPTION
## 描述

Remove artifacts from the target directory that Cargo has generated in the
past.
将Cargo生成的工件从生成目标目录中移除。

With no options, `cargo clean` will delete the entire target directory.
若不添加参数,`cargo clean` 会删除整个target目录。

## OPTIONS
## 可选参数

### Package Selection
### 选择包

When no packages are selected, all packages and all dependencies in the
workspace are cleaned.
若不指定包名,则清除工作目录中的所有的包和依赖

{{#options}}
{{#option "`-p` _spec_..." "`--package` _spec_..." }}
Clean only the specified packages. This flag may be specified
multiple times. See {{man "cargo-pkgid" 1}} for the SPEC format.
只清理参数指定的包中的文件。这个参数可以多次使用来指定多个包,详见 {{man "cargo-pkgid" 1}} 。
{{/option}}
{{/options}}

### Clean Options
### 清理选项

{{#options}}

{{#option "`--doc`" }}
This option will cause `cargo clean` to remove only the `doc` directory in
the target directory.
添加该参数后,`cargo clean`命令只会移除生成目标目录中的`doc`目录。
{{/option}}

{{#option "`--release`" }}
Clean all artifacts that were built with the `release` or `bench` profiles.
移除`release`目录中的工件。
{{/option}}

{{#option "`--profile` _name_" }}
移除指定编译配置(__Profile__)目录中的全部工件。
{{/option}}

{{> options-target-dir }}
Expand All @@ -49,13 +49,13 @@ Clean all artifacts that were built with the `release` or `bench` profiles.

{{/options}}

### Display Options
### 显示选项

{{#options}}
{{> options-display }}
{{/options}}

### Manifest Options
### 清单选项

{{#options}}
{{> options-manifest-path }}
Expand All @@ -69,15 +69,15 @@ Clean all artifacts that were built with the `release` or `bench` profiles.

{{> section-exit-status }}

## EXAMPLES
## 示例

1. Remove the entire target directory:
1. 移除整个生成目标目录:

cargo clean

2. Remove only the release artifacts:
2. 仅移除release目录中的工件:

cargo clean --release

## SEE ALSO
## 相关
{{man "cargo" 1}}, {{man "cargo-build" 1}}
22 changes: 18 additions & 4 deletions man/cargo-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ is placed in `target/doc` in rustdoc's usual format.

{{#option "`--open`" }}
Open the docs in a browser after building them. This will use your default
browser unless you define another one in the `BROWSER` environment variable.
browser unless you define another one in the `BROWSER` environment variable
or use the [`doc.browser`](../reference/config.html#docbrowser) configuration
option.
{{/option}}

{{#option "`--no-deps`" }}
Do not build documentation for dependencies.
{{/option}}

{{#option "`--document-private-items`" }}
Include non-public items in the documentation.
Include non-public items in the documentation. This will be enabled by default if documenting a binary target.
{{/option}}

{{/options}}
Expand All @@ -50,6 +52,16 @@ flag and will always document the given target.

{{#options}}
{{> options-targets-lib-bin }}

{{#option "`--example` _name_..." }}
{{actionverb}} the specified example. This flag may be specified multiple times
and supports common Unix glob patterns.
{{/option}}

{{#option "`--examples`" }}
{{actionverb}} all example targets.
{{/option}}

{{/options}}

{{> section-features }}
Expand All @@ -62,6 +74,10 @@ flag and will always document the given target.

{{> options-release }}

{{> options-profile }}

{{> options-ignore-rust-version }}

{{/options}}

### Output Options
Expand Down Expand Up @@ -94,8 +110,6 @@ flag and will always document the given target.
{{> options-jobs }}
{{/options}}

{{> section-profiles }}

{{> section-environment }}

{{> section-exit-status }}
Expand Down
6 changes: 3 additions & 3 deletions man/cargo-fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ When no target selection options are given, `cargo fix` will fix all targets

{{> options-release }}

{{> options-profile }}
{{> options-profile-legacy-check }}

{{> options-ignore-rust-version }}

{{/options}}

Expand Down Expand Up @@ -154,8 +156,6 @@ When no target selection options are given, `cargo fix` will fix all targets
{{> options-jobs }}
{{/options}}

{{> section-profiles }}

{{> section-environment }}

{{> section-exit-status }}
Expand Down
8 changes: 7 additions & 1 deletion man/cargo-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ change, then Cargo will reinstall the package:
- The package version and source.
- The set of binary names installed.
- The chosen features.
- The release mode (`--debug`).
- The profile (`--profile`).
- The target (`--target`).

Installing with `--path` will always build and install, unless there are
Expand Down Expand Up @@ -162,8 +162,11 @@ Directory to install packages into.

{{#option "`--debug`" }}
Build with the `dev` profile instead the `release` profile.
See also the `--profile` option for choosing a specific profile by name.
{{/option}}

{{> options-profile }}

{{/options}}

### Manifest Options
Expand All @@ -182,6 +185,9 @@ Build with the `dev` profile instead the `release` profile.

{{#options}}
{{> options-display }}

{{> options-message-format }}

{{/options}}

{{> section-options-common }}
Expand Down
4 changes: 4 additions & 0 deletions man/cargo-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ The output has the following format:
"categories": [
"command-line-utilities"
],
/* Optional string that is the default binary picked by cargo run. */
"default_run": null,
/* Optional string that is the minimum supported rust version */
"rust_version": "1.56",
/* Array of keywords from the manifest. */
"keywords": [
"cli"
Expand Down
Loading

0 comments on commit 1e58990

Please sign in to comment.