aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-22 20:22:28 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-22 20:23:15 +0800
commitfe39e74efbdcca56e0edefa5bb3cabe2dae4135a (patch)
treeafa8ebda68138314b78d130fdd7c80356ba339eb
parenta64ff145c4454d4e8c088f4564679415895472b6 (diff)
feat(docs): add docsrs flag and unify doc scripts
Migrate existing doc scripts to call the deploy-api-docs tool, and add nightly variants that build with --cfg docsrs
-rw-r--r--.run/src/bin/deploy-api-docs.rs26
-rw-r--r--.run/src/bin/doc.ps16
-rwxr-xr-x.run/src/bin/doc.sh6
-rw-r--r--.run/src/bin/doc_nightly.ps11
-rwxr-xr-x.run/src/bin/doc_nightly.sh3
5 files changed, 27 insertions, 15 deletions
diff --git a/.run/src/bin/deploy-api-docs.rs b/.run/src/bin/deploy-api-docs.rs
index 7aa093c..ac4486e 100644
--- a/.run/src/bin/deploy-api-docs.rs
+++ b/.run/src/bin/deploy-api-docs.rs
@@ -1,10 +1,16 @@
use std::path::Path;
+use arg_picker::{Picker, macros::arg};
use tools::{println_cargo_style, run_cmd};
const OUTPUT_DIR: &str = "docs/api-docs";
fn main() {
+ let (using_docsrs, open) = Picker::from_args()
+ .pick_or_default(&arg![docsrs: bool])
+ .pick_or_default(&arg![open: bool, 'O'])
+ .unwrap();
+
let repo_root = find_git_repo().expect("Failed to find git repository root");
// Read features from [package.metadata.docs.rs]
@@ -20,11 +26,21 @@ fn main() {
std::fs::create_dir_all(&output_path).expect("Failed to create output directory");
// Build cargo doc command
- let cmd = format!(
- "cargo doc --no-deps --features \"{}\" -p mingling --target-dir \"{}\" --color always",
- features_arg,
- output_path.join("target").to_string_lossy()
- );
+ let cmd = if using_docsrs {
+ format!(
+ "cargo +nightly rustdoc {} --features \"{}\" -p mingling --target-dir \"{}\" --color always -- --cfg docsrs",
+ if open { "--open" } else { "" },
+ features_arg,
+ output_path.join("target").to_string_lossy()
+ )
+ } else {
+ format!(
+ "cargo doc --no-deps {} --features \"{}\" -p mingling --target-dir \"{}\" --color always",
+ if open { "--open" } else { "" },
+ features_arg,
+ output_path.join("target").to_string_lossy()
+ )
+ };
println_cargo_style!("Features: {}", features_arg);
println_cargo_style!("Output: {}", output_path.display());
diff --git a/.run/src/bin/doc.ps1 b/.run/src/bin/doc.ps1
index 0e55141..7c3f222 100644
--- a/.run/src/bin/doc.ps1
+++ b/.run/src/bin/doc.ps1
@@ -1,5 +1 @@
-cargo doc `
- --manifest-path mingling/Cargo.toml `
- --no-deps `
- --features docs_rs,core,macros,builds,structural_renderer,repl,comp,parser,picker,clap,extra_macros `
- --open
+cargo dev_tool deploy-api-docs -- --open
diff --git a/.run/src/bin/doc.sh b/.run/src/bin/doc.sh
index 014ea44..8c809b7 100755
--- a/.run/src/bin/doc.sh
+++ b/.run/src/bin/doc.sh
@@ -1,7 +1,3 @@
#!/bin/bash
-cargo doc \
- --manifest-path mingling/Cargo.toml \
- --no-deps \
- --features docs_rs,core,macros,builds,structural_renderer,repl,comp,parser,picker,clap,extra_macros \
- --open
+cargo dev_tool deploy-api-docs -- --open
diff --git a/.run/src/bin/doc_nightly.ps1 b/.run/src/bin/doc_nightly.ps1
new file mode 100644
index 0000000..3d8289e
--- /dev/null
+++ b/.run/src/bin/doc_nightly.ps1
@@ -0,0 +1 @@
+cargo dev_tool deploy-api-docs -- --docsrs --open
diff --git a/.run/src/bin/doc_nightly.sh b/.run/src/bin/doc_nightly.sh
new file mode 100755
index 0000000..10f9021
--- /dev/null
+++ b/.run/src/bin/doc_nightly.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+cargo dev_tool deploy-api-docs -- --docsrs --open