diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-04 20:33:11 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-04 20:33:11 +0800 |
| commit | 8ee352832555c77a3c2a12673e303df4ac49c34f (patch) | |
| tree | 6c6a7af168da0467949c8e001ca9a814b386c6c9 | |
| parent | c308ee61c65df23b58cae12b2f2f99d754f3dbff (diff) | |
docs: add help text for CLI commands and descriptions
Add help text for global flags, commands, and subcommands in
help.txt. Add metadata descriptions for linter and metadata
commands.
| -rw-r--r-- | mingling_cli/help/help.txt | 27 | ||||
| -rw-r--r-- | mingling_cli/src/linter.rs | 24 | ||||
| -rw-r--r-- | mingling_cli/src/linter/cmd_mlint.rs | 8 | ||||
| -rw-r--r-- | mingling_cli/src/metadata/cmd_metadata.rs | 10 |
4 files changed, 66 insertions, 3 deletions
diff --git a/mingling_cli/help/help.txt b/mingling_cli/help/help.txt index 85a4fb7..d5073e6 100644 --- a/mingling_cli/help/help.txt +++ b/mingling_cli/help/help.txt @@ -1,3 +1,30 @@ USAGE: mling [GLOBAL_FLAGS] [COMMAND] [ARGS...] GLOBAL_FLAGS: + --all-features Enable all features + --features <FEATURES> List of features to enable + -h, --help Show help messages + --manifest-path <PATH> Custom path to Cargo.toml + --message-format <FORMAT> Output message format + --no-default-features Disable default features + --no-deps Do not include dependencies in metadata + +COMMANDS: + metadata Check your workspace metadata using 'cargo metadata' + + LINTER: + lint Mingling Linter + ra-lint Run `mling lint` and output the results + ra-lint-check Run `mling lint` and `cargo check`, and output the combined results + ra-lint-clippy Run `mling lint` and `cargo clippy`, and output the combined results + explain <LINT> [NOT_IMPL] Explain the meaning of the specified Lint + + PROJECT MANAGE: + proj-new <NAME> [NOT_IMPL] Create a project + proj-init [NOT_IMPL] Initialize a project + + PACKAGE MANAGE: + install [NOT_IMPL] Install the project to the Mingling package list + package-show [NOT_IMPL] Show locally installed packages + package-enable <NAME> [NOT_IMPL] Enable the specified package + package-disable <NAME> [NOT_IMPL] Disable the specified package diff --git a/mingling_cli/src/linter.rs b/mingling_cli/src/linter.rs index 8be45c8..3182b4a 100644 --- a/mingling_cli/src/linter.rs +++ b/mingling_cli/src/linter.rs @@ -1,4 +1,7 @@ -use mingling::macros::{chain, dispatcher, entry}; +use mingling::{ + macros::{chain, dispatcher, entry, metadata}, + metadata::Description, +}; use crate::{linter::cmd_mlint::EntryLint, metadata::setup::ResUsingJson}; @@ -43,3 +46,22 @@ pub fn handle_ra_lint_clippy( use_json.using = true; entry!("--message-format=json", "--with-checker=cargo,clippy") } + +#[metadata(EntryLinterSupportRustAnalyzer)] +pub fn desc_ra_lint() -> Description { + "Run `mling lint` and output the results".to_string().into() +} + +#[metadata(EntryLinterSupportRustAnalyzerWithCheck)] +pub fn desc_ra_lint_check() -> Description { + "Run `mling lint` and `cargo check`, and output the combined results" + .to_string() + .into() +} + +#[metadata(EntryLinterSupportRustAnalyzerWithClippy)] +pub fn desc_ra_lint_clippy() -> Description { + "Run `mling lint` and `cargo clippy`, and output the combined results" + .to_string() + .into() +} diff --git a/mingling_cli/src/linter/cmd_mlint.rs b/mingling_cli/src/linter/cmd_mlint.rs index 1dfd02b..57a78ad 100644 --- a/mingling_cli/src/linter/cmd_mlint.rs +++ b/mingling_cli/src/linter/cmd_mlint.rs @@ -2,12 +2,18 @@ use crate::linter::mlint_report::{MlintReport, StateLintReports}; use cargo_metadata::Metadata; use mingling::LazyRes; use mingling::consts::REMAINS; -use mingling::macros::{arg, chain, dispatcher, pack}; +use mingling::macros::{arg, chain, dispatcher, metadata, pack}; +use mingling::metadata::Description; use mingling::picker::EntryPicker; use tokio::task::JoinSet; dispatcher!("lint", CMDLint => EntryLint); +#[metadata(EntryLint)] +pub fn desc_lint() -> Description { + "Mingling Linter".to_string().into() +} + /// Main linting function that processes all packages in the metadata. /// /// Iterates through all packages and their targets (e.g., binaries, libraries, tests), diff --git a/mingling_cli/src/metadata/cmd_metadata.rs b/mingling_cli/src/metadata/cmd_metadata.rs index 18241a2..3ee9f09 100644 --- a/mingling_cli/src/metadata/cmd_metadata.rs +++ b/mingling_cli/src/metadata/cmd_metadata.rs @@ -1,13 +1,21 @@ use cargo_metadata::Metadata; use mingling::{ LazyRes, - macros::{chain, dispatcher, pack}, + macros::{chain, dispatcher, metadata, pack}, + metadata::Description, }; use crate::metadata::setup::ResMetadata; dispatcher!("metadata"); +#[metadata(EntryMetadata)] +pub fn desc_metadata() -> Description { + "Check your workspace metadata using 'cargo metadata'" + .to_string() + .into() +} + pack!(ResultMetadata = ResMetadata); #[chain] |
