diff options
| -rw-r--r-- | .cargo/config.toml | 4 | ||||
| -rw-r--r-- | .github/workflows/ci-check-only.yml | 47 | ||||
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | .run/.gitignore | 7 | ||||
| -rw-r--r-- | .run/Cargo.lock (renamed from dev_tools/Cargo.lock) | 0 | ||||
| -rw-r--r-- | .run/Cargo.toml (renamed from dev_tools/Cargo.toml) | 2 | ||||
| -rw-r--r-- | .run/src/bin/build-all.ps1 (renamed from dev_tools/scripts/build-all.ps1) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/build-all.sh (renamed from dev_tools/scripts/build-all.sh) | 0 | ||||
| -rw-r--r-- | .run/src/bin/ci.rs (renamed from dev_tools/src/bin/ci.rs) | 14 | ||||
| -rw-r--r-- | .run/src/bin/clippy-fix.ps1 (renamed from dev_tools/scripts/clippy-fix.ps1) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/clippy-fix.sh (renamed from dev_tools/scripts/clippy-fix.sh) | 0 | ||||
| -rw-r--r-- | .run/src/bin/clippy.ps1 (renamed from dev_tools/scripts/clippy.ps1) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/clippy.sh (renamed from dev_tools/scripts/clippy.sh) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/doc.ps1 (renamed from dev_tools/scripts/doc.ps1) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/doc.sh (renamed from dev_tools/scripts/doc.sh) | 0 | ||||
| -rw-r--r-- | .run/src/bin/docs-code-box-fix.rs (renamed from dev_tools/src/bin/docs-code-box-fix.rs) | 0 | ||||
| -rw-r--r-- | .run/src/bin/docsify-sidebar-gen.rs (renamed from dev_tools/src/bin/docsify-sidebar-gen.rs) | 15 | ||||
| -rw-r--r-- | .run/src/bin/http-page-preview.ps1 (renamed from dev_tools/scripts/http-page-preview.ps1) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/http-page-preview.sh (renamed from dev_tools/scripts/http-page-preview.sh) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/install-mling.ps1 (renamed from dev_tools/scripts/install-mling.ps1) | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | .run/src/bin/install-mling.sh (renamed from dev_tools/scripts/install-mling.sh) | 0 | ||||
| -rw-r--r-- | .run/src/bin/refresh-docs.rs (renamed from dev_tools/src/bin/refresh-docs.rs) | 0 | ||||
| -rw-r--r-- | .run/src/bin/refresh-feature-mod.rs (renamed from dev_tools/src/bin/refresh-feature-mod.rs) | 0 | ||||
| -rw-r--r-- | .run/src/bin/sync-examples.rs (renamed from dev_tools/src/bin/sync-examples.rs) | 0 | ||||
| -rw-r--r-- | .run/src/bin/test-all-markdown-code.rs (renamed from dev_tools/src/bin/test-all-markdown-code.rs) | 0 | ||||
| -rw-r--r-- | .run/src/bin/test-all.ps1 (renamed from dev_tools/scripts/test-all.ps1) | 0 | ||||
| -rw-r--r-- | .run/src/bin/test-all.sh (renamed from dev_tools/scripts/test-all.sh) | 0 | ||||
| -rw-r--r-- | .run/src/bin/test-examples.rs (renamed from dev_tools/src/bin/test-examples.rs) | 0 | ||||
| -rw-r--r-- | .run/src/bin/update-version.rs (renamed from dev_tools/src/bin/update-version.rs) | 18 | ||||
| -rw-r--r-- | .run/src/bin/windows-folder-hide.ps1 (renamed from dev_tools/scripts/windows-folder-hide.ps1) | 0 | ||||
| -rw-r--r-- | .run/src/lib.rs (renamed from dev_tools/src/lib.rs) | 4 | ||||
| -rw-r--r-- | .run/src/verify.rs (renamed from dev_tools/src/verify.rs) | 4 | ||||
| -rw-r--r-- | .run/version-files.toml (renamed from dev_tools/version-files.toml) | 0 | ||||
| -rw-r--r-- | CONTRIBUTING.md | 159 | ||||
| -rw-r--r-- | Cargo.lock | 47 | ||||
| -rw-r--r-- | Cargo.toml | 8 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | docs/_zh_CN/index.html | 2 | ||||
| -rw-r--r-- | docs/dev-docs/README.md | 15 | ||||
| -rw-r--r-- | docs/dev-docs/pages/abouts/.name | 1 | ||||
| -rw-r--r-- | docs/dev-docs/pages/issues/.name | 1 | ||||
| -rw-r--r-- | docs/dev-docs/pages/templates/.name | 1 | ||||
| -rw-r--r-- | docs/dev/README.md | 21 | ||||
| -rw-r--r-- | docs/dev/_sidebar.md (renamed from docs/dev-docs/_sidebar.md) | 14 | ||||
| -rw-r--r-- | docs/dev/index.html (renamed from docs/dev-docs/index.html) | 2 | ||||
| -rw-r--r-- | docs/dev/pages/abouts/.name | 1 | ||||
| -rw-r--r-- | docs/dev/pages/abouts/ai-translation-rule.md (renamed from docs/dev-docs/pages/abouts/ai-translation-rule.md) | 0 | ||||
| -rw-r--r-- | docs/dev/pages/abouts/ci.md (renamed from ABOUT-CI.md) | 31 | ||||
| -rw-r--r-- | docs/dev/pages/abouts/code-verify-system.md (renamed from docs/dev-docs/pages/abouts/code-verify-system.md) | 0 | ||||
| -rw-r--r-- | docs/dev/pages/abouts/nightly-features.md (renamed from ABOUT-NIGHTLY.md) | 7 | ||||
| -rw-r--r-- | docs/dev/pages/issues/.name | 1 | ||||
| -rw-r--r-- | docs/dev/pages/issues/remove-r-print-macro.md (renamed from docs/dev-docs/pages/issues/remove-r-print-macro.md) | 12 | ||||
| -rw-r--r-- | docs/dev/pages/issues/the-mod-pathfinder.md (renamed from docs/dev-docs/pages/issues/the-mod-pathfinder.md) | 0 | ||||
| -rw-r--r-- | docs/dev/pages/issues/the-shit-time.md (renamed from docs/dev-docs/pages/issues/the-shit-time.md) | 10 | ||||
| -rw-r--r-- | docs/dev/pages/templates/.name | 1 | ||||
| -rw-r--r-- | docs/dev/pages/templates/doc.md (renamed from docs/dev-docs/pages/templates/doc.md) | 0 | ||||
| -rw-r--r-- | docs/doc.html | 2 | ||||
| -rw-r--r-- | examples/example-argument-parse/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-async-support/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-basic/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-clap-binding/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-combine-pathf-dispatch-tree/Cargo.lock | 6 | ||||
| -rw-r--r-- | examples/example-completion/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-custom-pickable/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-dispatch-tree/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-enum-tag/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-error-handling/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-exitcode/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-help/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-hook/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-implicit-dispatcher/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-lazy-resources/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-outside-type/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-pack-err/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-panic-unwind/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-pathfinder/Cargo.lock | 6 | ||||
| -rw-r--r-- | examples/example-repl-basic/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-resources/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-setup/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-structural-renderer/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/example-unit-test/Cargo.lock | 4 | ||||
| -rw-r--r-- | examples/full-todolist/Cargo.lock | 4 | ||||
| -rw-r--r-- | mingling_core/tests/test-all/Cargo.lock | 4 | ||||
| -rw-r--r-- | mingling_core/tests/test-basic/Cargo.lock | 4 | ||||
| -rw-r--r-- | mingling_core/tests/test-comp/Cargo.lock | 4 | ||||
| -rw-r--r-- | mingling_core/tests/test-dispatch-tree/Cargo.lock | 4 | ||||
| -rw-r--r-- | mingling_core/tests/test-repl/Cargo.lock | 4 | ||||
| -rw-r--r-- | mingling_core/tests/test-structural-renderer/Cargo.lock | 4 | ||||
| -rw-r--r-- | mling/res/template_0.2/command/Cargo.toml.tmpl (renamed from mling/res/template_0.2/command/Cargo.toml) | 0 | ||||
| -rw-r--r-- | mling/res/template_0.2/flat/Cargo.toml.tmpl (renamed from mling/res/template_0.2/flat/Cargo.toml) | 0 | ||||
| -rw-r--r-- | mling/res/template_0.2/modularity/Cargo.toml.tmpl (renamed from mling/res/template_0.2/modularity/Cargo.toml) | 0 | ||||
| -rw-r--r-- | run-tools.ps1 | 60 | ||||
| -rwxr-xr-x | run-tools.sh | 64 | ||||
| -rw-r--r-- | run.ps1 | 232 | ||||
| -rw-r--r-- | run.sh | 257 |
95 files changed, 957 insertions, 240 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml index 0b45ca9..f375b03 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -4,5 +4,5 @@ target-dir = "./.temp/target" [env] [alias] -ci = "run --manifest-path dev_tools/Cargo.toml --bin ci --quiet --" -dev_tool = "run --manifest-path dev_tools/Cargo.toml --quiet --bin " +ci = "run --manifest-path .run/Cargo.toml --bin ci --quiet --" +dev_tool = "run --manifest-path .run/Cargo.toml --quiet --bin " diff --git a/.github/workflows/ci-check-only.yml b/.github/workflows/ci-check-only.yml new file mode 100644 index 0000000..1179ed0 --- /dev/null +++ b/.github/workflows/ci-check-only.yml @@ -0,0 +1,47 @@ +name: CI (Check only) + +on: + push: + branches-ignore: [main] + pull_request: + +jobs: + Check-Codes: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Restore .temp cache + id: cache-temp + uses: actions/cache@v4 + with: + path: .temp + key: ${{ runner.os }}-mingling-temp-${{ hashFiles('Cargo.lock', 'dev_tools/Cargo.toml', 'verified-docs.toml', 'examples/test-examples.toml') }}-${{ hashFiles('dev_tools/src/**/*.rs') }} + restore-keys: | + ${{ runner.os }}-mingling-temp- + + - run: cargo ci --test-codes + + Check-Docs: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Restore .temp cache + id: cache-temp + uses: actions/cache@v4 + with: + path: .temp + key: ${{ runner.os }}-mingling-temp-${{ hashFiles('Cargo.lock', 'dev_tools/Cargo.toml', 'verified-docs.toml', 'examples/test-examples.toml') }}-${{ hashFiles('dev_tools/src/**/*.rs') }} + restore-keys: | + ${{ runner.os }}-mingling-temp- + + - run: cargo ci --test-docs @@ -6,3 +6,6 @@ dev_tools/scripts/last_check # Drafts __*.md __*/ + +# Fuck +nul diff --git a/.run/.gitignore b/.run/.gitignore new file mode 100644 index 0000000..0dc39b0 --- /dev/null +++ b/.run/.gitignore @@ -0,0 +1,7 @@ +# All temp build artifacts will be stored in this dir +/target + +# If you want to add some Rust crates? Remove this line +# /Cargo.* + +last_check diff --git a/dev_tools/Cargo.lock b/.run/Cargo.lock index bb510bd..bb510bd 100644 --- a/dev_tools/Cargo.lock +++ b/.run/Cargo.lock diff --git a/dev_tools/Cargo.toml b/.run/Cargo.toml index 9855580..283aa47 100644 --- a/dev_tools/Cargo.toml +++ b/.run/Cargo.toml @@ -19,3 +19,5 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" tokio = { version = "1", features = ["rt-multi-thread", "macros"] } indicatif = "0.18.4" + +[workspace] diff --git a/dev_tools/scripts/build-all.ps1 b/.run/src/bin/build-all.ps1 index 4f35ed8..4f35ed8 100644 --- a/dev_tools/scripts/build-all.ps1 +++ b/.run/src/bin/build-all.ps1 diff --git a/dev_tools/scripts/build-all.sh b/.run/src/bin/build-all.sh index 2036b41..2036b41 100755..100644 --- a/dev_tools/scripts/build-all.sh +++ b/.run/src/bin/build-all.sh diff --git a/dev_tools/src/bin/ci.rs b/.run/src/bin/ci.rs index f8aed79..2527ece 100644 --- a/dev_tools/src/bin/ci.rs +++ b/.run/src/bin/ci.rs @@ -139,12 +139,12 @@ fn ci(test_docs: bool, test_codes: bool, run_all: bool) -> Result<(), i32> { } fn test_examples() -> Result<(), i32> { - run_cmd!("cargo run --manifest-path dev_tools/Cargo.toml --color always --bin test-examples") + run_cmd!("cargo run --manifest-path .run/Cargo.toml --color always --bin test-examples") } fn test_docs_code_blocks() -> Result<(), i32> { run_cmd!( - "cargo run --manifest-path dev_tools/Cargo.toml --color always --bin test-all-markdown-code" + "cargo run --manifest-path .run/Cargo.toml --color always --bin test-all-markdown-code" ) } @@ -214,11 +214,11 @@ fn test_all() -> Result<(), i32> { fn docs_refresh() -> Result<(), i32> { println_cargo_style!("Refresh: document at `./docs/`"); - run_cmd!("cargo run --manifest-path dev_tools/Cargo.toml --bin docs-code-box-fix")?; - run_cmd!("cargo run --manifest-path dev_tools/Cargo.toml --bin docsify-sidebar-gen")?; - run_cmd!("cargo run --manifest-path dev_tools/Cargo.toml --bin refresh-docs")?; - run_cmd!("cargo run --manifest-path dev_tools/Cargo.toml --bin refresh-feature-mod")?; - run_cmd!("cargo run --manifest-path dev_tools/Cargo.toml --bin sync-examples")?; + run_cmd!("cargo run --manifest-path .run/Cargo.toml --bin docs-code-box-fix")?; + run_cmd!("cargo run --manifest-path .run/Cargo.toml --bin docsify-sidebar-gen")?; + run_cmd!("cargo run --manifest-path .run/Cargo.toml --bin refresh-docs")?; + run_cmd!("cargo run --manifest-path .run/Cargo.toml --bin refresh-feature-mod")?; + run_cmd!("cargo run --manifest-path .run/Cargo.toml --bin sync-examples")?; run_cmd!("cargo fmt")?; Ok(()) diff --git a/dev_tools/scripts/clippy-fix.ps1 b/.run/src/bin/clippy-fix.ps1 index 1d24f92..1d24f92 100644 --- a/dev_tools/scripts/clippy-fix.ps1 +++ b/.run/src/bin/clippy-fix.ps1 diff --git a/dev_tools/scripts/clippy-fix.sh b/.run/src/bin/clippy-fix.sh index 9771ad4..9771ad4 100755..100644 --- a/dev_tools/scripts/clippy-fix.sh +++ b/.run/src/bin/clippy-fix.sh diff --git a/dev_tools/scripts/clippy.ps1 b/.run/src/bin/clippy.ps1 index 1858873..1858873 100644 --- a/dev_tools/scripts/clippy.ps1 +++ b/.run/src/bin/clippy.ps1 diff --git a/dev_tools/scripts/clippy.sh b/.run/src/bin/clippy.sh index b393545..b393545 100755..100644 --- a/dev_tools/scripts/clippy.sh +++ b/.run/src/bin/clippy.sh diff --git a/dev_tools/scripts/doc.ps1 b/.run/src/bin/doc.ps1 index 987f0de..987f0de 100755..100644 --- a/dev_tools/scripts/doc.ps1 +++ b/.run/src/bin/doc.ps1 diff --git a/dev_tools/scripts/doc.sh b/.run/src/bin/doc.sh index 5e8a311..5e8a311 100755..100644 --- a/dev_tools/scripts/doc.sh +++ b/.run/src/bin/doc.sh diff --git a/dev_tools/src/bin/docs-code-box-fix.rs b/.run/src/bin/docs-code-box-fix.rs index 21d2cce..21d2cce 100644 --- a/dev_tools/src/bin/docs-code-box-fix.rs +++ b/.run/src/bin/docs-code-box-fix.rs diff --git a/dev_tools/src/bin/docsify-sidebar-gen.rs b/.run/src/bin/docsify-sidebar-gen.rs index b926112..5beda7f 100644 --- a/dev_tools/src/bin/docsify-sidebar-gen.rs +++ b/.run/src/bin/docsify-sidebar-gen.rs @@ -43,7 +43,7 @@ fn find_all_readmes(dir: &Path) -> Vec<PathBuf> { let path = entry.path(); if path.is_dir() { results.extend(find_all_readmes(&path)); - } else if path.file_name().map_or(false, |n| n == "README.md") { + } else if path.file_name().is_some_and(|n| n == "README.md") { results.push(path); } } @@ -67,11 +67,10 @@ fn find_content_dir(site_root: &Path) -> Option<PathBuf> { entries.sort_by_key(|e| e.path()); for entry in entries { let path = entry.path(); - if path.is_dir() { - if has_markdown_files(&path) { + if path.is_dir() + && has_markdown_files(&path) { return Some(path); } - } } } @@ -254,12 +253,10 @@ fn natural_cmp(a: &str, b: &str) -> std::cmp::Ordering { /// Looks at the filename stem (after the last `/`) for a number before the first `-`. /// Returns `usize::MAX` for entries without a numeric prefix. fn extract_leading_number(link: &str) -> usize { - if let Some(file_stem) = link.rsplit('/').next() { - if let Some(num_end) = file_stem.find('-') { - if let Ok(num) = file_stem[..num_end].parse::<usize>() { + if let Some(file_stem) = link.rsplit('/').next() + && let Some(num_end) = file_stem.find('-') + && let Ok(num) = file_stem[..num_end].parse::<usize>() { return num; } - } - } usize::MAX } diff --git a/dev_tools/scripts/http-page-preview.ps1 b/.run/src/bin/http-page-preview.ps1 index 8cc3579..8cc3579 100644 --- a/dev_tools/scripts/http-page-preview.ps1 +++ b/.run/src/bin/http-page-preview.ps1 diff --git a/dev_tools/scripts/http-page-preview.sh b/.run/src/bin/http-page-preview.sh index bed4b1c..bed4b1c 100755..100644 --- a/dev_tools/scripts/http-page-preview.sh +++ b/.run/src/bin/http-page-preview.sh diff --git a/dev_tools/scripts/install-mling.ps1 b/.run/src/bin/install-mling.ps1 index bebe9ff..bebe9ff 100755..100644 --- a/dev_tools/scripts/install-mling.ps1 +++ b/.run/src/bin/install-mling.ps1 diff --git a/dev_tools/scripts/install-mling.sh b/.run/src/bin/install-mling.sh index 5f2ee7a..5f2ee7a 100755..100644 --- a/dev_tools/scripts/install-mling.sh +++ b/.run/src/bin/install-mling.sh diff --git a/dev_tools/src/bin/refresh-docs.rs b/.run/src/bin/refresh-docs.rs index 82ef906..82ef906 100644 --- a/dev_tools/src/bin/refresh-docs.rs +++ b/.run/src/bin/refresh-docs.rs diff --git a/dev_tools/src/bin/refresh-feature-mod.rs b/.run/src/bin/refresh-feature-mod.rs index 2255dbc..2255dbc 100644 --- a/dev_tools/src/bin/refresh-feature-mod.rs +++ b/.run/src/bin/refresh-feature-mod.rs diff --git a/dev_tools/src/bin/sync-examples.rs b/.run/src/bin/sync-examples.rs index 0923b33..0923b33 100644 --- a/dev_tools/src/bin/sync-examples.rs +++ b/.run/src/bin/sync-examples.rs diff --git a/dev_tools/src/bin/test-all-markdown-code.rs b/.run/src/bin/test-all-markdown-code.rs index 280fca7..280fca7 100644 --- a/dev_tools/src/bin/test-all-markdown-code.rs +++ b/.run/src/bin/test-all-markdown-code.rs diff --git a/dev_tools/scripts/test-all.ps1 b/.run/src/bin/test-all.ps1 index 231698a..231698a 100644 --- a/dev_tools/scripts/test-all.ps1 +++ b/.run/src/bin/test-all.ps1 diff --git a/dev_tools/scripts/test-all.sh b/.run/src/bin/test-all.sh index b387463..b387463 100644 --- a/dev_tools/scripts/test-all.sh +++ b/.run/src/bin/test-all.sh diff --git a/dev_tools/src/bin/test-examples.rs b/.run/src/bin/test-examples.rs index 539459e..539459e 100644 --- a/dev_tools/src/bin/test-examples.rs +++ b/.run/src/bin/test-examples.rs diff --git a/dev_tools/src/bin/update-version.rs b/.run/src/bin/update-version.rs index 475e54b..9d595bb 100644 --- a/dev_tools/src/bin/update-version.rs +++ b/.run/src/bin/update-version.rs @@ -39,7 +39,9 @@ fn main() { let root_cargo_path = "Cargo.toml"; let root_cargo_content = std::fs::read_to_string(root_cargo_path).expect("Failed to read Cargo.toml"); - let cargo_value: toml::Value = root_cargo_content.parse().expect("Failed to parse Cargo.toml"); + let cargo_value: toml::Value = root_cargo_content + .parse() + .expect("Failed to parse Cargo.toml"); let current_ver = cargo_value["workspace"]["package"]["version"] .as_str() @@ -54,11 +56,11 @@ fn main() { println_cargo_style!("Version: {} -> {}", current_ver, new_ver); // Read version-files.toml - let config_path = Path::new("dev_tools").join("version-files.toml"); + let config_path = Path::new(".run").join("version-files.toml"); let config_str = - std::fs::read_to_string(&config_path).expect("Failed to read dev_tools/version-files.toml"); - let config: Config = toml::from_str(&config_str) - .expect("Failed to parse dev_tools/version-files.toml"); + std::fs::read_to_string(&config_path).expect("Failed to read .run/version-files.toml"); + let config: Config = + toml::from_str(&config_str).expect("Failed to parse .run/version-files.toml"); let mut updated_count = 0; let mut skipped_count = 0; @@ -94,5 +96,9 @@ fn main() { updated_count += 1; } - println_cargo_style!("Done: {} file(s) updated, {} file(s) skipped", updated_count, skipped_count); + println_cargo_style!( + "Done: {} file(s) updated, {} file(s) skipped", + updated_count, + skipped_count + ); } diff --git a/dev_tools/scripts/windows-folder-hide.ps1 b/.run/src/bin/windows-folder-hide.ps1 index 0ab2632..0ab2632 100644 --- a/dev_tools/scripts/windows-folder-hide.ps1 +++ b/.run/src/bin/windows-folder-hide.ps1 diff --git a/dev_tools/src/lib.rs b/.run/src/lib.rs index d38a156..232afb3 100644 --- a/dev_tools/src/lib.rs +++ b/.run/src/lib.rs @@ -316,8 +316,8 @@ pub fn cargo_tomls() -> Vec<std::path::PathBuf> { for entry in entries.flatten() { let path = entry.path(); if path.is_dir() { - // Skip the dev_tools directory - if path.file_name().and_then(|n| n.to_str()) == Some("dev_tools") { + // Skip the .run directory + if path.file_name().and_then(|n| n.to_str()) == Some(".run") { continue; } dirs.push(path); diff --git a/dev_tools/src/verify.rs b/.run/src/verify.rs index 2ddff0c..0a4b354 100644 --- a/dev_tools/src/verify.rs +++ b/.run/src/verify.rs @@ -76,10 +76,10 @@ fn parse_single_block(lines: &[&str], start: usize, source_file: &str) -> Option // @@@ lines: strip the prefix and treat as regular Rust code // These lines are hidden in the rendered docs (filtered by a docsify plugin) // but must still compile. - if trimmed.starts_with("@@@") { + if let Some(stripped) = trimmed.strip_prefix("@@@") { in_header = false; // Strip @@@ and optionally one following space - let code = trimmed[3..].trim_start(); + let code = stripped.trim_start(); if code.contains("fn main") { has_main = true; } diff --git a/dev_tools/version-files.toml b/.run/version-files.toml index ca104d2..ca104d2 100644 --- a/dev_tools/version-files.toml +++ b/.run/version-files.toml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d90db4a..f63832a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,50 +4,137 @@ First of all, thank you for your interest in Mingling! 🎉 Whether it's fixing Before contributing, we recommend reading [README](README.md) to get an overview of the project. -## 1. Project Structure - -| Category | Path/Name | Description | -| ---------------------------- | ------------------------- | ------------------------------------------------------------------------------------- | -| **Entry crate** | `mingling/` | Project entry point | -| **Core library** | `mingling_core/` | Imported as an external dependency | -| **Macro library** | `mingling_macros/` | Imported as an external dependency | -| **Examples** | `examples/` | To add expected output tests, modify `examples/test-examples.toml` | -| **Documentation, resources** | `docs/` | All documentation and resource files | -| **Development tools** | `dev_tools/` | Contains scripts and Rust tools | -| Scripts | `dev_tools/scripts/` | Helper `.sh`/`.ps1`/`.py` scripts, executed via `./run-tools.sh` or `.\run-tools.ps1` | -| Rust tools | `dev_tools/src/bin/` | Same as above | -| CI check entry | `dev_tools/src/bin/ci.rs` | Can be invoked directly via `cargo ci` | -| **Scaffolding tool** | `mling/` | Scaffolding tool `mingling-cli` | -| **Temporary files** | `.temp/` | Ignored by `.gitignore` | - -## 2. Submission Guide +## 1. Project Structure 📦 + +| Category | Path/Name | Description | +| ----------------------- | -------------------- | ------------------------------------------------------------------ | +| **Entry crate** | `mingling/` | Project entry point | +| **Core library** | `mingling_core/` | Imported as an external dependency | +| **Macro library** | `mingling_macros/` | Imported as an external dependency | +| **Mingling Pathfinder** | `mingling_pathf/` | Build-time module path resolution for types | +| **Scaffolding tool** | `mling/` | Scaffolding tool `mingling-cli` | +| **Examples** | `examples/` | To add expected output tests, modify `examples/test-examples.toml` | +| **Documents** | `docs/` | All documents | +| **Dev Documents** | `docs/dev/` | Internal documents | +| **Resources** | `docs/res/` | All resources | +| **Development tools** | `.run/src/bin` | Contains scripts and Rust tools | +| **CI** | `.run/src/bin/ci.rs` | Can be invoked directly via `cargo ci` | +| **Temporary files** | `.temp/` | Ignored by `.gitignore` | + +## 2. How to Contribute + +### Code Contribution + +If you'd like to contribute to `mingling`, `mingling_core`, `mingling_macros`, or `mingling_pathf`, first share your idea on the [Github Issue](https://github.com/mingling-rs/mingling/issues) page to confirm before starting work. + +- **Before making changes**, make sure your branch stays **as close as possible** to the upstream `main` branch. +- **After finishing**, run `cargo ci` locally (see [ABOUT CI](https://mingling-rs.github.io/mingling/docs/dev/#/pages/abouts/ci) for how it works). If `cargo ci` passes locally, your changes are most likely correct. + +### Example Code Contribution + +To add or modify examples under `examples/`, follow these rules: + +- Place each example in `examples/<example-dir>/` +- Each dir must contain a `page.toml` file describing the example's metadata +- `page.toml` format: + +```toml +[example] +id = "example-id" # Unique identifier +name = "Example Name" # Display name (optional, defaults to dir name) +icon = "📦" # Icon (optional, defaults to "📦") +category = "" # Category (optional) +desc = "Description" # Description (optional) +tags = ["tag1", "tag2"] # Tags (optional) +files = ["Cargo.toml", "src/main.rs"] +``` -1. **Pull Request** +If you change expected behavior, update the test assertions in `examples/test-examples.toml`. + +After editing examples, run these scripts to keep things in sync: + +```bash +# Ensure code compiles +./run.sh build-all + +# Ensure code style +./run.sh clippy + +# Sync page.toml info to docs/example-pages/examples.json +./run.sh sync-examples + +# Check all examples behave as expected +./run.sh test-examples + +# Sync examples content into mingling/src/example_docs.rs +./run.sh refresh-docs + +# (Optional) Preview the Example Viewer in a browser +# Requires: Python +./run.sh http-page-preview +# http://127.0.0.1:3000/ +``` + +### Documentation Contribution + +To contribute docs, edit files under `docs/`. For other language translations, refer to the structure under `docs/zh_CN`. + +- **When editing docs**, prioritize **Chinese docs** first, then **English docs** — since I ([@Weicao-CatilGrass](https://github.com/Weicao-CatilGrass)) am a native Chinese speaker, this is more efficient. +- If your changes involve code, check the [Code Verify System](https://mingling-rs.github.io/mingling/docs/dev/#/pages/abouts/code-verify-system), which explains how CI checks code. +- **Before submitting**, always run: - - Submit a GitHub Pull Request and @Reviewer **[Weicao-CatilGrass](https://github.com/Weicao-CatilGrass)** for review - - Or send patches to **catil_grass@qq.com** +```bash +# Fix code block issues in docsify +./run.sh docs-code-box-fix + +# Generate sidebar +./run.sh docsify-sidebar-gen + +# Verify all Markdown code blocks compile +./run.sh test-all-markdown-code +``` + +### Web Frontend Contribution + +No strict requirements here — just modify the relevant `*.html` files. Preview with: + +```bash +# Requires: Python +./run.sh http-page-preview +# http://127.0.0.1:3000/ +``` + +### Dev Tool Contribution + +`Mingling CI` code is under strict review. If you want to improve `mingling`'s CI pipeline or other dev tools (under `.run/`), **please** first file an [Issue](https://github.com/mingling-rs/mingling/issues) and contact [Weicao-CatilGrass](https://github.com/Weicao-CatilGrass)! + +## 3. Submission Guide 🖊 + +1. **Pull Request** + - Submit a GitHub Pull Request and @Reviewer **[Weicao-CatilGrass](https://github.com/Weicao-CatilGrass)** for review + - Or send patches to **catil_grass@qq.com** 2. **Commit Messages** - - Clearly and concisely describe the changes, no stringent requirements - - Provide more detail for complex changes, keep it brief for simple changes - - But: if you use [Conventional Commits](https://www.conventionalcommits.org/), it would make me even happier :) + - Clearly and concisely describe the changes, no stringent requirements + - Provide more detail for complex changes, keep it brief for simple changes + - But: if you use [Conventional Commits](https://www.conventionalcommits.org/), it would make me even happier :) 3. **CHANGELOG** - - If the submission includes functional changes or fixes, **the PR must include modifications to CHANGELOG.md** to describe the changes - - For minor changes like typo fixes, **CHANGELOG.md modification is not required**, and we will merge faster + - If the submission includes functional changes or fixes, **the PR must include modifications to CHANGELOG.md** to describe the changes + - For minor changes like typo fixes, **CHANGELOG.md modification is not required**, and we will merge faster 4. **Multi-commit PR** - - A PR can contain multiple commits - - However, at least one commit must modify CHANGELOG.md + - A PR can contain multiple commits + - However, at least one commit must modify CHANGELOG.md 5. **Review** - - After submission, please notify [Weicao-CatilGrass](https://github.com/Weicao-CatilGrass) for review — this is the most efficient way to get feedback + - After submission, please notify [Weicao-CatilGrass](https://github.com/Weicao-CatilGrass) for review — this is the most efficient way to get feedback 6. **Binary Resources** - - For binary resource files (images, etc.), please be cautious about adding them to avoid repository bloat + - For binary resource files (images, etc.), please be cautious about adding them to avoid repository bloat -## 3. Documentation Contribution +## 4. Documentation Contribution 📕 ### Documentation Location @@ -60,25 +147,25 @@ After editing documentation, refresh relevant files: ```bash # Refresh sidebar and README sync -./run-tools.sh docsify-sidebar-gen -./run-tools.sh refresh-docs +./run.sh docsify-sidebar-gen +./run.sh refresh-docs # Fix code block blank line issues -./run-tools.sh docs-code-box-fix +./run.sh docs-code-box-fix ``` These steps are included in `cargo ci`; running `cargo ci` will execute them automatically. > [!TIP] -> You can check the [ABOUT CI](./ABOUT-CI.md) section to learn how "Mingling CI" works. +> You can check the [ABOUT CI](https://mingling-rs.github.io/mingling/docs/dev/#/pages/abouts/ci) section to learn how "Mingling CI" works. -## 4. Regarding AI Agent Usage +## 5. Regarding AI Agent Usage 🤖 - You are free to use AI agents to assist development — no restrictions - **Humans are the final decision-makers**, everything is subject to human judgment - Please **DO NOT** leave AI instruction files like `CLAUDE.md` in the repository root. Mingling currently has no plans to introduce **Harness Engineering** -## 5. License +## 6. License 📖 Mingling uses the **MIT + Apache 2.0** dual license. For details, please see: @@ -404,8 +404,8 @@ name = "mingling" version = "0.2.2" dependencies = [ "mingling", - "mingling_core", - "mingling_macros", + "mingling_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mingling_macros 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde", "size", "tokio", @@ -433,7 +433,25 @@ dependencies = [ "just_fmt", "just_template", "log", - "mingling_pathf", + "mingling_pathf 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ron", + "serde", + "serde_json", + "serde_yaml", + "toml", +] + +[[package]] +name = "mingling_core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" +dependencies = [ + "env_logger", + "just_fmt", + "just_template", + "log", + "mingling_pathf 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ron", "serde", "serde_json", @@ -452,8 +470,31 @@ dependencies = [ ] [[package]] +name = "mingling_macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" +dependencies = [ + "just_fmt", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "mingling_pathf" +version = "0.2.2" +dependencies = [ + "just_fmt", + "proc-macro2", + "syn", +] + +[[package]] name = "mingling_pathf" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134fb0a329f4cc605298eb47683cd2e9eaa184bf651215cbc72d411e9533a4be" dependencies = [ "just_fmt", "proc-macro2", @@ -9,7 +9,7 @@ exclude = [ "examples/*", # Dev Tools - "dev_tools", + ".run", # Tests "mingling_core/tests/*", @@ -17,9 +17,9 @@ exclude = [ ] [workspace.dependencies] -mingling_core = { path = "mingling_core", default-features = false } -mingling_macros = { path = "mingling_macros", default-features = false } -mingling_pathf = { path = "mingling_pathf", default-features = false } +mingling_core = { version = "0.2.2", default-features = false } +mingling_macros = { version = "0.2.2", default-features = false } +mingling_pathf = { version = "0.2.2", default-features = false } just_fmt = "0.1.2" just_template = "0.2.0" @@ -54,7 +54,7 @@ - 📖 [Examples](https://mingling-rs.github.io/mingling/docs/examples.html) - 📖 [docs.rs](https://docs.rs/mingling/latest/mingling/) - 📖 [Helpdoc](https://mingling-rs.github.io/mingling/docs/doc.html#/) Or [帮助文档](https://mingling-rs.github.io/mingling/docs/_zh_CN/index.html#/) -- 🔍 [Devdoc](https://mingling-rs.github.io/mingling/docs/dev-docs/) +- 🔍 [Devdoc](https://mingling-rs.github.io/mingling/docs/dev/) <h1 align="center"> Getting Started diff --git a/docs/_zh_CN/index.html b/docs/_zh_CN/index.html index 7adaa98..ad21062 100644 --- a/docs/_zh_CN/index.html +++ b/docs/_zh_CN/index.html @@ -56,7 +56,7 @@ auto2top: true, loadSidebar: true, maxLevel: 0, - subMaxLevel: 3, + subMaxLevel: 0, search: { placeholder: "Search", noData: "No matches found.", diff --git a/docs/dev-docs/README.md b/docs/dev-docs/README.md deleted file mode 100644 index a2eede9..0000000 --- a/docs/dev-docs/README.md +++ /dev/null @@ -1,15 +0,0 @@ -<h1 align="center">Mingling Dev Docs</h1> - -<p align="center"> - Internal development documentation for the <b>Mingling</b> codebase — design notes, issue discussions, and architectural decisions. -</p> - -This site is separate from the [main helpdoc](https://mingling-rs.github.io/mingling/docs/doc.html). The helpdoc is user-facing: tutorials, feature guides, and how-to content for developers _using_ Mingling to build CLI applications. This dev-docs site is for developers _working on_ Mingling itself — understanding internal mechanisms, tracking unresolved problems, and recording design rationale. - -## What's here - -- **Issues** — Collected notes on known pain points, unresolved trade-offs, and feature gaps in the current implementation. - -## How this is different from GitHub Issues - -Mingling is hosted on [GitHub](https://github.com/mingling-rs/mingling), and the [Issues page](https://github.com/mingling-rs/mingling/issues) there is primarily for discussion. In contrast, an issue in this document exists only when it is being planned or actively worked on. diff --git a/docs/dev-docs/pages/abouts/.name b/docs/dev-docs/pages/abouts/.name deleted file mode 100644 index d5a4a33..0000000 --- a/docs/dev-docs/pages/abouts/.name +++ /dev/null @@ -1 +0,0 @@ -Abouts diff --git a/docs/dev-docs/pages/issues/.name b/docs/dev-docs/pages/issues/.name deleted file mode 100644 index f99478d..0000000 --- a/docs/dev-docs/pages/issues/.name +++ /dev/null @@ -1 +0,0 @@ -Issues diff --git a/docs/dev-docs/pages/templates/.name b/docs/dev-docs/pages/templates/.name deleted file mode 100644 index 1e1408c..0000000 --- a/docs/dev-docs/pages/templates/.name +++ /dev/null @@ -1 +0,0 @@ -Templates diff --git a/docs/dev/README.md b/docs/dev/README.md new file mode 100644 index 0000000..9289fcf --- /dev/null +++ b/docs/dev/README.md @@ -0,0 +1,21 @@ +<h1 align="center">Mingling Dev Docs</h1> + +<p align="center"> + Internal development documentation for the <b>Mingling</b> codebase — design notes, issue discussions, and architectural decisions. +</p> + +This site is separate from the [Helpdoc](https://mingling-rs.github.io/mingling/docs/doc.html). + +The helpdoc is user-facing: `tutorials`, `feature guides`, and `how-to content` for developers _using_ Mingling to build CLI applications. + +This dev-docs site is for developers **working on** Mingling itself — understanding internal mechanisms, tracking unresolved problems, and recording design rationale. + +## What's here + +- **Issues** — Collected notes on known pain points, unresolved trade-offs, and feature gaps in the current implementation. + +## How this is different from GitHub Issues + +Mingling is hosted on [GitHub](https://github.com/mingling-rs/mingling), and the [Issues page](https://github.com/mingling-rs/mingling/issues) there is primarily for discussion. + +In contrast, an issue in this document exists only when it is being planned or actively worked on. diff --git a/docs/dev-docs/_sidebar.md b/docs/dev/_sidebar.md index dd735c4..e303735 100644 --- a/docs/dev-docs/_sidebar.md +++ b/docs/dev/_sidebar.md @@ -1,10 +1,12 @@ - [Welcome!](README) -* Abouts - * [AI Translation Rule](pages/abouts/ai-translation-rule) - * [Markdown Code Verification System](pages/abouts/code-verify-system) -* Issues - * [remove-r-print-macro](pages/issues/remove-r-print-macro) +* ❓ Issues + * [Remove r_print! and r_println! Macros](pages/issues/remove-r-print-macro) * [The Mod Pathfinder](pages/issues/the-mod-pathfinder) * [Some Situations Where You'd Be Like "Shit!"](pages/issues/the-shit-time) -* Templates +* 💡 Abouts + * [AI Translation Rule](pages/abouts/ai-translation-rule) + * [About Mingling CI Process](pages/abouts/ci) + * [Markdown Code Verification System](pages/abouts/code-verify-system) + * [About Nightly Features](pages/abouts/nightly-features) +* 📄 Templates * [Helpdoc Template](pages/templates/doc) diff --git a/docs/dev-docs/index.html b/docs/dev/index.html index e62268d..1bfb5c5 100644 --- a/docs/dev-docs/index.html +++ b/docs/dev/index.html @@ -141,7 +141,7 @@ auto2top: true, loadSidebar: true, maxLevel: 0, - subMaxLevel: 3, + subMaxLevel: 0, search: { placeholder: "Search dev docs…", noData: "No matches found.", diff --git a/docs/dev/pages/abouts/.name b/docs/dev/pages/abouts/.name new file mode 100644 index 0000000..f2b936c --- /dev/null +++ b/docs/dev/pages/abouts/.name @@ -0,0 +1 @@ +💡 Abouts diff --git a/docs/dev-docs/pages/abouts/ai-translation-rule.md b/docs/dev/pages/abouts/ai-translation-rule.md index b1f93f6..b1f93f6 100644 --- a/docs/dev-docs/pages/abouts/ai-translation-rule.md +++ b/docs/dev/pages/abouts/ai-translation-rule.md diff --git a/ABOUT-CI.md b/docs/dev/pages/abouts/ci.md index 762fab8..3a93c1c 100644 --- a/ABOUT-CI.md +++ b/docs/dev/pages/abouts/ci.md @@ -1,6 +1,9 @@ -# About Mingling CI Process +<h1 align="center">About Mingling CI Process</h1> +<p align="center"> + CI workflow and local execution guide for Mingling +</p> -Mingling's CI process is built into the project, with its execution logic located in `dev_tools/src/bin/ci.rs`. You can run it locally via the `cargo ci` command, which produces the same results as the `CI` workflow in GitHub Actions. +Mingling's CI process is built into the project, with its execution logic located in `.run/src/bin/ci.rs`. You can run it locally via the `cargo ci` command, which produces the same results as the `CI` workflow in GitHub Actions. During development, you can run `cargo ci` at any time to verify that your code hasn't introduced regressions. @@ -10,15 +13,15 @@ An alias is defined in `.cargo/config.toml` at the project root: ```toml [alias] -ci = "run --manifest-path dev_tools/Cargo.toml --bin ci --quiet --" +ci = "run --manifest-path .run/Cargo.toml --bin ci --quiet --" ``` - + Simply execute: ```bash cargo ci ``` - + ## CI Execution Flow `cargo ci` runs the following stages in order: @@ -34,11 +37,11 @@ cargo ci - **Test all examples**: Runs the `test-examples` tool. - **Verify Markdown code blocks compile**: Runs the `test-all-markdown-code` tool to check code blocks in all `*.md` files. See [ABOUT_CODE_VERIFY](docs/_ABOUT_CODE_VERIFY.md) for details. - **Check if documentation is up to date**: Runs the following documentation refresh tools in sequence: - - `docs-code-box-fix` - - `docsify-sidebar-gen` - - `refresh-docs` - - `refresh-feature-mod` - - `sync-examples` + - `docs-code-box-fix` + - `docsify-sidebar-gen` + - `refresh-docs` + - `refresh-feature-mod` + - `sync-examples` - Finally, runs `cargo fmt` to unify code formatting. ### 3. File Normalization @@ -50,11 +53,11 @@ Runs `git add --renormalize .` to ensure file attributes such as line endings co To ensure reproducible CI results, `ci.rs` imposes strict requirements on the workspace state: - If the current workspace is not clean and `--dirty` has not been specified, the script will prompt whether to create a temporary commit: - - The commit message is `[DO NOT PUSH] CI TEMP [DO NOT PUSH]`. - - Use `-y` to auto-confirm without interaction. + - The commit message is `[DO NOT PUSH] CI TEMP [DO NOT PUSH]`. + - Use `-y` to auto-confirm without interaction. - After CI finishes, the script automatically restores the workspace: - - First, `git reset --hard` discards all changes. - - If a temporary commit was created, it then runs `git reset --soft HEAD~1` and unstages everything, restoring the state to before CI started. + - First, `git reset --hard` discards all changes. + - If a temporary commit was created, it then runs `git reset --soft HEAD~1` and unstages everything, restoring the state to before CI started. - If `--dirty` is specified, the temporary commit and the final cleanliness check are skipped. > **Warning**: `git reset --hard` is executed at the end of CI. If you use `--dirty`, ensure you have no unsaved important changes. diff --git a/docs/dev-docs/pages/abouts/code-verify-system.md b/docs/dev/pages/abouts/code-verify-system.md index 61b66e8..61b66e8 100644 --- a/docs/dev-docs/pages/abouts/code-verify-system.md +++ b/docs/dev/pages/abouts/code-verify-system.md diff --git a/ABOUT-NIGHTLY.md b/docs/dev/pages/abouts/nightly-features.md index f2d4ec7..13b666e 100644 --- a/ABOUT-NIGHTLY.md +++ b/docs/dev/pages/abouts/nightly-features.md @@ -1,4 +1,7 @@ -# About Nightly Rust +<h1 align="center">About Nightly Features</h1> +<p align="center"> + Using nightly Rust features in Mingling +</p> **Mingling** uses some features that are only available in the `nightly` toolchain. This requires you to enable the `nightly` feature: @@ -6,7 +9,7 @@ [dependencies] mingling = { version = "...", features = ["nightly"] } ``` - + ## Features > [!WARNING] diff --git a/docs/dev/pages/issues/.name b/docs/dev/pages/issues/.name new file mode 100644 index 0000000..b207fb4 --- /dev/null +++ b/docs/dev/pages/issues/.name @@ -0,0 +1 @@ +❓ Issues diff --git a/docs/dev-docs/pages/issues/remove-r-print-macro.md b/docs/dev/pages/issues/remove-r-print-macro.md index e5ef4a6..96f99ef 100644 --- a/docs/dev-docs/pages/issues/remove-r-print-macro.md +++ b/docs/dev/pages/issues/remove-r-print-macro.md @@ -1,4 +1,4 @@ -# Remove `r_print!` and `r_println!` Macros +<h1 align="center">Remove r_print! and r_println! Macros</h1> `r_print!` and `r_println!` are important macros in Mingling for use inside `#[help]` and `#[renderer]` functions, but their implementation is not clean: they implicitly introduce a `__renderer_inner_result` field. While this might look elegant at the API level, it is **incorrect** and even **objectionable**. @@ -85,3 +85,13 @@ More flexible, but blurs the boundary between logic functions like `#[chain]` an I lean toward **Option 1 (Explicit Return)**. There's no need to turn `RenderResult` into `ResRenderResult` as a global resource. As for rendering in logic functions like `#[chain]`, that should be handled by a separate system — not discussed here. + +## 🕘 Progress + +- [ ] In Progress + - [ ] Remove `r_println!` and `r_print!` macros + - [ ] Modify `#[renderer]` and `#[help]` macros, remove implicit injection + - [ ] Provide **no-return-value mode** and **RenderResult return value mode** for `#[renderer]` and `#[help]` macros + - [ ] Add new simplified syntax + - [ ] Update documentation and test cases, ensure **all pass** +- [ ] Complete diff --git a/docs/dev-docs/pages/issues/the-mod-pathfinder.md b/docs/dev/pages/issues/the-mod-pathfinder.md index 676251d..676251d 100644 --- a/docs/dev-docs/pages/issues/the-mod-pathfinder.md +++ b/docs/dev/pages/issues/the-mod-pathfinder.md diff --git a/docs/dev-docs/pages/issues/the-shit-time.md b/docs/dev/pages/issues/the-shit-time.md index f524f42..9d6c429 100644 --- a/docs/dev-docs/pages/issues/the-shit-time.md +++ b/docs/dev/pages/issues/the-shit-time.md @@ -83,6 +83,16 @@ fn desc_add() -> String { t!("cmd.add.desc") } +// Or + +#[completion(CMDAdd)] +fn desc_add(_ctx: &ShellContext) -> Suggest { + // If using rust_i18n + suggest{ + t!("cmd.add.desc") + } +} + // Collected and generated by `gen_program!()` // Generate something like get_dispatcher_desc(id: &ThisProgram) -> String // Match the corresponding function using enum values inside ThisProgram diff --git a/docs/dev/pages/templates/.name b/docs/dev/pages/templates/.name new file mode 100644 index 0000000..9e73889 --- /dev/null +++ b/docs/dev/pages/templates/.name @@ -0,0 +1 @@ +📄 Templates diff --git a/docs/dev-docs/pages/templates/doc.md b/docs/dev/pages/templates/doc.md index e8a9308..e8a9308 100644 --- a/docs/dev-docs/pages/templates/doc.md +++ b/docs/dev/pages/templates/doc.md diff --git a/docs/doc.html b/docs/doc.html index 783ccb4..a63fdd3 100644 --- a/docs/doc.html +++ b/docs/doc.html @@ -51,7 +51,7 @@ auto2top: true, loadSidebar: true, maxLevel: 0, - subMaxLevel: 3, + subMaxLevel: 0, search: { placeholder: "Search", noData: "No matches found.", diff --git a/examples/example-argument-parse/Cargo.lock b/examples/example-argument-parse/Cargo.lock index fbca1a6..d519d9d 100644 --- a/examples/example-argument-parse/Cargo.lock +++ b/examples/example-argument-parse/Cargo.lock @@ -27,6 +27,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -34,6 +36,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-async-support/Cargo.lock b/examples/example-async-support/Cargo.lock index a252836..56858e8 100644 --- a/examples/example-async-support/Cargo.lock +++ b/examples/example-async-support/Cargo.lock @@ -28,6 +28,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -35,6 +37,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-basic/Cargo.lock b/examples/example-basic/Cargo.lock index 286d906..e8d55bf 100644 --- a/examples/example-basic/Cargo.lock +++ b/examples/example-basic/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-clap-binding/Cargo.lock b/examples/example-clap-binding/Cargo.lock index f0f6d2a..ba7dbc3 100644 --- a/examples/example-clap-binding/Cargo.lock +++ b/examples/example-clap-binding/Cargo.lock @@ -135,6 +135,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -142,6 +144,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-combine-pathf-dispatch-tree/Cargo.lock b/examples/example-combine-pathf-dispatch-tree/Cargo.lock index a44d5e6..8eb1a8f 100644 --- a/examples/example-combine-pathf-dispatch-tree/Cargo.lock +++ b/examples/example-combine-pathf-dispatch-tree/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "mingling_pathf", @@ -34,6 +36,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", @@ -44,6 +48,8 @@ dependencies = [ [[package]] name = "mingling_pathf" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134fb0a329f4cc605298eb47683cd2e9eaa184bf651215cbc72d411e9533a4be" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-completion/Cargo.lock b/examples/example-completion/Cargo.lock index 38a3f46..7b8bd98 100644 --- a/examples/example-completion/Cargo.lock +++ b/examples/example-completion/Cargo.lock @@ -48,6 +48,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "just_template", @@ -56,6 +58,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-custom-pickable/Cargo.lock b/examples/example-custom-pickable/Cargo.lock index baf0a69..7006ce6 100644 --- a/examples/example-custom-pickable/Cargo.lock +++ b/examples/example-custom-pickable/Cargo.lock @@ -27,6 +27,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -34,6 +36,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-dispatch-tree/Cargo.lock b/examples/example-dispatch-tree/Cargo.lock index ab81170..0314dd5 100644 --- a/examples/example-dispatch-tree/Cargo.lock +++ b/examples/example-dispatch-tree/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-enum-tag/Cargo.lock b/examples/example-enum-tag/Cargo.lock index 21032d4..081176b 100644 --- a/examples/example-enum-tag/Cargo.lock +++ b/examples/example-enum-tag/Cargo.lock @@ -48,6 +48,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "just_template", @@ -56,6 +58,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-error-handling/Cargo.lock b/examples/example-error-handling/Cargo.lock index a534538..c6effce 100644 --- a/examples/example-error-handling/Cargo.lock +++ b/examples/example-error-handling/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-exitcode/Cargo.lock b/examples/example-exitcode/Cargo.lock index e6e5f5c..6f3a730 100644 --- a/examples/example-exitcode/Cargo.lock +++ b/examples/example-exitcode/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-help/Cargo.lock b/examples/example-help/Cargo.lock index 4be15ec..8c3fb07 100644 --- a/examples/example-help/Cargo.lock +++ b/examples/example-help/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-hook/Cargo.lock b/examples/example-hook/Cargo.lock index bda9d39..e83ec75 100644 --- a/examples/example-hook/Cargo.lock +++ b/examples/example-hook/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-implicit-dispatcher/Cargo.lock b/examples/example-implicit-dispatcher/Cargo.lock index f5a8bbb..f368597 100644 --- a/examples/example-implicit-dispatcher/Cargo.lock +++ b/examples/example-implicit-dispatcher/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-lazy-resources/Cargo.lock b/examples/example-lazy-resources/Cargo.lock index f47637c..342ebcb 100644 --- a/examples/example-lazy-resources/Cargo.lock +++ b/examples/example-lazy-resources/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-outside-type/Cargo.lock b/examples/example-outside-type/Cargo.lock index 7e1e6a6..240a444 100644 --- a/examples/example-outside-type/Cargo.lock +++ b/examples/example-outside-type/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-pack-err/Cargo.lock b/examples/example-pack-err/Cargo.lock index 2285d06..0776937 100644 --- a/examples/example-pack-err/Cargo.lock +++ b/examples/example-pack-err/Cargo.lock @@ -40,6 +40,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "serde", @@ -49,6 +51,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-panic-unwind/Cargo.lock b/examples/example-panic-unwind/Cargo.lock index fa3390c..c453b54 100644 --- a/examples/example-panic-unwind/Cargo.lock +++ b/examples/example-panic-unwind/Cargo.lock @@ -27,6 +27,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -34,6 +36,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-pathfinder/Cargo.lock b/examples/example-pathfinder/Cargo.lock index b56d570..f1d7564 100644 --- a/examples/example-pathfinder/Cargo.lock +++ b/examples/example-pathfinder/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "mingling_pathf", @@ -34,6 +36,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", @@ -44,6 +48,8 @@ dependencies = [ [[package]] name = "mingling_pathf" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134fb0a329f4cc605298eb47683cd2e9eaa184bf651215cbc72d411e9533a4be" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-repl-basic/Cargo.lock b/examples/example-repl-basic/Cargo.lock index ea11e89..ad07dc6 100644 --- a/examples/example-repl-basic/Cargo.lock +++ b/examples/example-repl-basic/Cargo.lock @@ -28,6 +28,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -35,6 +37,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-resources/Cargo.lock b/examples/example-resources/Cargo.lock index 19b513e..f16f414 100644 --- a/examples/example-resources/Cargo.lock +++ b/examples/example-resources/Cargo.lock @@ -27,6 +27,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -34,6 +36,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-setup/Cargo.lock b/examples/example-setup/Cargo.lock index a9f7407..5b7805b 100644 --- a/examples/example-setup/Cargo.lock +++ b/examples/example-setup/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-structural-renderer/Cargo.lock b/examples/example-structural-renderer/Cargo.lock index 9e88602..349a92f 100644 --- a/examples/example-structural-renderer/Cargo.lock +++ b/examples/example-structural-renderer/Cargo.lock @@ -41,6 +41,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "serde", @@ -50,6 +52,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/example-unit-test/Cargo.lock b/examples/example-unit-test/Cargo.lock index cd9bb01..8ec0ab7 100644 --- a/examples/example-unit-test/Cargo.lock +++ b/examples/example-unit-test/Cargo.lock @@ -26,6 +26,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -33,6 +35,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/examples/full-todolist/Cargo.lock b/examples/full-todolist/Cargo.lock index 11bfa0d..f46c5ad 100644 --- a/examples/full-todolist/Cargo.lock +++ b/examples/full-todolist/Cargo.lock @@ -42,6 +42,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "serde", @@ -51,6 +53,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/mingling_core/tests/test-all/Cargo.lock b/mingling_core/tests/test-all/Cargo.lock index 1f9b0f7..d18eb47 100644 --- a/mingling_core/tests/test-all/Cargo.lock +++ b/mingling_core/tests/test-all/Cargo.lock @@ -122,6 +122,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "just_template", @@ -135,6 +137,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/mingling_core/tests/test-basic/Cargo.lock b/mingling_core/tests/test-basic/Cargo.lock index 4fb3bda..ef023a7 100644 --- a/mingling_core/tests/test-basic/Cargo.lock +++ b/mingling_core/tests/test-basic/Cargo.lock @@ -19,6 +19,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -26,6 +28,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/mingling_core/tests/test-comp/Cargo.lock b/mingling_core/tests/test-comp/Cargo.lock index 657f19a..b951a91 100644 --- a/mingling_core/tests/test-comp/Cargo.lock +++ b/mingling_core/tests/test-comp/Cargo.lock @@ -40,6 +40,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "just_template", @@ -48,6 +50,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/mingling_core/tests/test-dispatch-tree/Cargo.lock b/mingling_core/tests/test-dispatch-tree/Cargo.lock index b6b57b2..14027ae 100644 --- a/mingling_core/tests/test-dispatch-tree/Cargo.lock +++ b/mingling_core/tests/test-dispatch-tree/Cargo.lock @@ -19,6 +19,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -26,6 +28,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/mingling_core/tests/test-repl/Cargo.lock b/mingling_core/tests/test-repl/Cargo.lock index 6919aac..b811703 100644 --- a/mingling_core/tests/test-repl/Cargo.lock +++ b/mingling_core/tests/test-repl/Cargo.lock @@ -19,6 +19,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", ] @@ -26,6 +28,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/mingling_core/tests/test-structural-renderer/Cargo.lock b/mingling_core/tests/test-structural-renderer/Cargo.lock index 640719d..962d2d4 100644 --- a/mingling_core/tests/test-structural-renderer/Cargo.lock +++ b/mingling_core/tests/test-structural-renderer/Cargo.lock @@ -64,6 +64,8 @@ dependencies = [ [[package]] name = "mingling_core" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64318a9b61120f0deaf33c4ab9efc9313387dece2defd7841665242807634ea" dependencies = [ "just_fmt", "ron", @@ -76,6 +78,8 @@ dependencies = [ [[package]] name = "mingling_macros" version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29efa15f48e39fd4a06868030545b1938e5ba050929cd9a235525814bfb6367" dependencies = [ "just_fmt", "proc-macro2", diff --git a/mling/res/template_0.2/command/Cargo.toml b/mling/res/template_0.2/command/Cargo.toml.tmpl index e69de29..e69de29 100644 --- a/mling/res/template_0.2/command/Cargo.toml +++ b/mling/res/template_0.2/command/Cargo.toml.tmpl diff --git a/mling/res/template_0.2/flat/Cargo.toml b/mling/res/template_0.2/flat/Cargo.toml.tmpl index e69de29..e69de29 100644 --- a/mling/res/template_0.2/flat/Cargo.toml +++ b/mling/res/template_0.2/flat/Cargo.toml.tmpl diff --git a/mling/res/template_0.2/modularity/Cargo.toml b/mling/res/template_0.2/modularity/Cargo.toml.tmpl index e69de29..e69de29 100644 --- a/mling/res/template_0.2/modularity/Cargo.toml +++ b/mling/res/template_0.2/modularity/Cargo.toml.tmpl diff --git a/run-tools.ps1 b/run-tools.ps1 deleted file mode 100644 index 7aa2c9c..0000000 --- a/run-tools.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -Set-Location -Path (Split-Path -Parent $MyInvocation.MyCommand.Path) -ErrorAction Stop - -# Collect all available tool names -$tools = @() - -if (Test-Path "dev_tools/scripts") { - $scripts = Get-ChildItem -Path "dev_tools/scripts/*.ps1", "dev_tools/scripts/*.py" - foreach ($script in $scripts) { - if ($script -is [System.IO.FileInfo]) { - $tools += $script.BaseName - } - } -} -if (Test-Path "dev_tools/src/bin") { - $files = Get-ChildItem -Path "dev_tools/src/bin/*.rs" - foreach ($file in $files) { - if ($file -is [System.IO.FileInfo]) { - $tools += $file.BaseName - } - } -} - -if ($args.Count -eq 0) { - Write-Host "Available:" - for ($i = 0; $i -lt $tools.Count; $i++) { - Write-Host (" [{0,2}] {1}" -f ($i + 1), $tools[$i]) - } - exit 1 -} - -$target_name = $args[0] - -# Check if input is a number -if ($target_name -match '^\d+$') { - $idx = [int]$target_name - 1 - if ($idx -ge 0 -and $idx -lt $tools.Count) { - $target_name = $tools[$idx] - } else { - Write-Host "Error: invalid number '$target_name', valid range is 1-$($tools.Count)" - exit 1 - } -} - -# Collect remaining arguments to pass to the script -$script_args = $args[1..$args.Count] - -$script_file_ps1 = "dev_tools/scripts/${target_name}.ps1" -$script_file_py = "dev_tools/scripts/${target_name}.py" -$rust_file = "dev_tools/src/bin/${target_name}.rs" - -if (Test-Path $script_file_ps1) { - & $script_file_ps1 $script_args -} elseif (Test-Path $script_file_py) { - python $script_file_py $script_args -} elseif (Test-Path $rust_file) { - cargo run --manifest-path dev_tools/Cargo.toml --bin $target_name --quiet -- $script_args -} else { - Write-Host "Error: target '$target_name' does not exist as a script or Rust program" - exit 1 -} diff --git a/run-tools.sh b/run-tools.sh deleted file mode 100755 index 9a68f0e..0000000 --- a/run-tools.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")" || exit 1 - -# Collect all available tool names -tools=() - -if [ -d "dev_tools/scripts" ]; then - for file in dev_tools/scripts/*.sh; do - if [ -f "$file" ]; then - tools+=("$(basename "$file" .sh)") - fi - done - for file in dev_tools/scripts/*.py; do - if [ -f "$file" ]; then - tools+=("$(basename "$file" .py)") - fi - done -fi -if [ -d "dev_tools/src/bin" ]; then - for file in dev_tools/src/bin/*.rs; do - if [ -f "$file" ]; then - tools+=("$(basename "$file" .rs)") - fi - done -fi - -if [ $# -eq 0 ]; then - echo "Available:" - for i in "${!tools[@]}"; do - printf " [%2d] %s\n" $((i + 1)) "${tools[$i]}" - done - exit 1 -fi - -target_bin="$1" -shift # Remove the first argument (tool name), keep the rest as tool arguments - -# Check if input is a number -if [[ "$target_bin" =~ ^[0-9]+$ ]]; then - idx=$((target_bin - 1)) - if [ "$idx" -ge 0 ] && [ "$idx" -lt "${#tools[@]}" ]; then - target_bin="${tools[$idx]}" - else - echo "Error: invalid number '$target_bin', valid range is 1-${#tools[@]}" - exit 1 - fi -fi - -target_script="dev_tools/scripts/${target_bin}.sh" -target_python="dev_tools/scripts/${target_bin}.py" -target_file="dev_tools/src/bin/${target_bin}.rs" - -if [ -f "$target_script" ]; then - chmod +x "$target_script" - "$target_script" "$@" -elif [ -f "$target_python" ]; then - python "$target_python" "$@" -elif [ -f "$target_file" ]; then - cargo run --manifest-path dev_tools/Cargo.toml --bin "$target_bin" --quiet -- "$@" -else - echo "Error: target '$target_bin' does not exist" - exit 1 -fi @@ -0,0 +1,232 @@ +# +# ██ ██████ ██ ██ ███ ██ ██████ ███████ ██ +# ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ███ +# ██ ██████ ██ ██ ██ ██ ██ ██████ ███████ ██ +# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +# ██ ██ ██ ██ ██████ ██ ████ ██ ██ ███████ ██ +# +# You can go to [https://catilgrass.github.io/run] to install it +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Set-Location -Path (Split-Path -Parent $MyInvocation.MyCommand.Path) -ErrorAction Stop + +$tools = @{} + +if (Test-Path ".run/src/bin/*.ps1") { + Get-ChildItem -Path ".run/src/bin/*.ps1" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "ps1"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.cs") { + Get-ChildItem -Path ".run/src/bin/*.cs" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "cs"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.exe") { + Get-ChildItem -Path ".run/src/bin/*.exe" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "exe"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.go") { + Get-ChildItem -Path ".run/src/bin/*.go" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "go"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.nim") { + Get-ChildItem -Path ".run/src/bin/*.nim" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "nim"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.pl") { + Get-ChildItem -Path ".run/src/bin/*.pl" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "pl"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.py") { + Get-ChildItem -Path ".run/src/bin/*.py" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "py"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.rb") { + Get-ChildItem -Path ".run/src/bin/*.rb" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "rb"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.rs") { + Get-ChildItem -Path ".run/src/bin/*.rs" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "rs"; Path = $_.FullName } + } +} + +if (Test-Path ".run/src/bin/*.zig") { + Get-ChildItem -Path ".run/src/bin/*.zig" | ForEach-Object { + $tools[$_.BaseName] = @{ Type = "zig"; Path = $_.FullName } + } +} + +if ($args.Count -eq 0) { + $sorted = @($tools.Keys | Sort-Object @{Expression={if ($tools[$_].Type -eq 'ps1') {0} else {1}}}, {$_}) + $total = $sorted.Count + $num_w = $total.ToString().Length + + $max_name = ($sorted | ForEach-Object { $_.Length } | Measure-Object -Maximum).Maximum + + $inner_w = 2 + $num_w + 1 + 1 + $max_name + 2 + 10 + 1 + 2 + if ($inner_w -lt 38) { $inner_w = 38 } + + $title = '.\run.ps1 <NUMBER/NAME> [ARGS...]' + $title_len = $title.Length + $dash_total = $inner_w - 2 - $title_len + $dash_left = [Math]::Floor($dash_total / 2) + $dash_right = $dash_total - $dash_left + + Write-Host ("┌" + ("─" * $dash_left) + " " + $title + " " + ("─" * $dash_right) + "┐") + Write-Host ("│" + (" " * $inner_w) + "│") + + $i = 1 + foreach ($name in $sorted) { + $type = $tools[$name].Type + $lang = switch ($type) { + "ps1" { "PowerShell" } + "cs" { "C#" } + "exe" { "Binary" } + "go" { "Go" } + "nim" { "Nim" } + "pl" { "Perl" } + "py" { "Python" } + "rb" { "Ruby" } + "rs" { "Rust" } + "zig" { "Zig" } + } + $displayName = $name -replace '[_\-]', ' ' + $entry = " " + $i.ToString().PadRight($num_w) + ") " + $displayName.PadRight($max_name) + " [$lang]" + Write-Host ("│" + $entry.PadRight($inner_w) + "│") + $i++ + } + + Write-Host ("│" + (" " * $inner_w) + "│") + Write-Host ("└" + ("─" * $inner_w) + "┘") + exit 1 +} + +$target_name = $args[0] + +if ($target_name -match '^\d+$') { + $sorted = @($tools.Keys | Sort-Object @{Expression={if ($tools[$_].Type -eq 'ps1') {0} else {1}}}, {$_}) + $idx = [int]$target_name - 1 + if ($idx -ge 0 -and $idx -lt $sorted.Count) { + $target_name = $sorted[$idx] + } else { + Write-Host "Error: invalid number '$target_name', valid range is 1-$($sorted.Count)" + exit 1 + } +} + +if (-not $tools.ContainsKey($target_name)) { + $normalized = $target_name.ToLower() -replace '[ _\-\.]', '' + $found = $null + foreach ($key in $tools.Keys) { + $keyNormalized = $key.ToLower() -replace '[ _\-\.]', '' + if ($normalized -eq $keyNormalized) { + $found = $key + break + } + } + if ($found) { + $target_name = $found + } else { + Write-Host "Error: target '$target_name' does not exist" + exit 1 + } +} + +$script_args = $args[1..$args.Count] +$info = $tools[$target_name] + +switch ($info.Type) { + "ps1" { + & $info.Path @script_args + } + "cs" { + $temp_dir = ".run/target/csproj/$target_name" + $null = New-Item -ItemType Directory -Path $temp_dir -Force + + $props_content = @' +<Project> + <PropertyGroup> + <BaseOutputPath>$(MSBuildThisFileDirectory)../../csharp/bin</BaseOutputPath> + <BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)../../csharp/obj</BaseIntermediateOutputPath> + </PropertyGroup> +</Project> +'@ + Set-Content -Path "$temp_dir/Directory.Build.props" -Value $props_content + + $csproj_content = @" +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + +</Project> +"@ + Set-Content -Path "$temp_dir/$target_name.csproj" -Value $csproj_content + Copy-Item -Path $info.Path -Destination "$temp_dir/Program.cs" -Force + + dotnet run --project "$temp_dir/$target_name.csproj" -- $script_args + } + "exe" { + & $info.Path $script_args + } + "go" { + go run $info.Path $script_args + } + "nim" { + nim r --hints:off $info.Path $script_args + } + "pl" { + perl $info.Path $script_args + } + "py" { + python $info.Path $script_args + } + "rb" { + ruby $info.Path $script_args + } + "rs" { + if (-not (Test-Path ".run/Cargo.toml")) { +@" +[package] +name = "run_rust" +version = "0.1.0" +edition = "2024" + +[workspace] + +[dependencies] +"@ | Set-Content -Path ".run/Cargo.toml" + } + cargo build --manifest-path ".run/Cargo.toml" --target-dir ".run/target" --bin $target_name --quiet + $binary = ".run/target/debug/$target_name.exe" + if (-not (Test-Path $binary)) { + $binary = ".run/target/debug/$target_name" + } + & $binary $script_args + } + "zig" { + zig run $info.Path $script_args + } +} + +exit $LASTEXITCODE @@ -0,0 +1,257 @@ +#!/bin/bash + +# +# ██ ██████ ██ ██ ███ ██ ███████ ██ ██ +# ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ +# ██ ██████ ██ ██ ██ ██ ██ ███████ ███████ +# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +# ██ ██ ██ ██ ██████ ██ ████ ██ ███████ ██ ██ +# +# You can go to [https://catilgrass.github.io/run] to install it +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +cd "$(dirname "$0")" || exit 1 + +declare -A tools + +for file in .run/src/bin/*.sh; do + if [ -f "$file" ]; then + name=$(basename "$file" .sh) + tools["$name"]="sh" + fi +done + +for file in .run/src/bin/*; do + if [ -f "$file" ]; then + name=$(basename "$file") + if [[ ! "$name" == *.* ]]; then + tools["$name"]="binary" + fi + fi +done + +for file in .run/src/bin/*.cs; do + if [ -f "$file" ]; then + name=$(basename "$file" .cs) + tools["$name"]="cs" + fi +done + +for file in .run/src/bin/*.go; do + if [ -f "$file" ]; then + name=$(basename "$file" .go) + tools["$name"]="go" + fi +done + +for file in .run/src/bin/*.nim; do + if [ -f "$file" ]; then + name=$(basename "$file" .nim) + tools["$name"]="nim" + fi +done + +for file in .run/src/bin/*.pl; do + if [ -f "$file" ]; then + name=$(basename "$file" .pl) + tools["$name"]="pl" + fi +done + +for file in .run/src/bin/*.py; do + if [ -f "$file" ]; then + name=$(basename "$file" .py) + tools["$name"]="py" + fi +done + +for file in .run/src/bin/*.rb; do + if [ -f "$file" ]; then + name=$(basename "$file" .rb) + tools["$name"]="rb" + fi +done + +for file in .run/src/bin/*.rs; do + if [ -f "$file" ]; then + name=$(basename "$file" .rs) + tools["$name"]="rs" + fi +done + +for file in .run/src/bin/*.zig; do + if [ -f "$file" ]; then + name=$(basename "$file" .zig) + tools["$name"]="zig" + fi +done + +if [ $# -eq 0 ]; then + sorted_names=($( + for name in "${!tools[@]}"; do + if [ "${tools[$name]}" = "sh" ]; then + echo "0 $name" + else + echo "1 $name" + fi + done | sort | while read -r _ n; do echo "$n"; done + )) + total=${#sorted_names[@]} + num_w=${#total} + + max_name=0 + for name in "${sorted_names[@]}"; do + len=${#name} + ((len > max_name)) && max_name=$len + done + + inner_w=$((2 + num_w + 1 + 1 + max_name + 2 + 6 + 1 + 2)) + ((inner_w < 38)) && inner_w=38 + + title="./run.sh <NUMBER/NAME> [ARGS...]" + title_len=${#title} + dash_total=$((inner_w - 2 - title_len)) + dash_left=$((dash_total / 2)) + dash_right=$((dash_total - dash_left)) + + echo "┌$(printf '─%.0s' $(seq 1 $dash_left)) $title $(printf '─%.0s' $(seq 1 $dash_right))┐" + printf "│%*s│\n" $inner_w "" + + i=1 + for name in "${sorted_names[@]}"; do + type="${tools[$name]}" + case "$type" in + sh) lang="Shell";; + binary) lang="Binary";; + cs) lang="C#";; + go) lang="Go";; + nim) lang="Nim";; + pl) lang="Perl";; + py) lang="Python";; + rb) lang="Ruby";; + rs) lang="Rust";; + zig) lang="Zig";; + esac + display_name=$(echo "$name" | tr '_-' ' ') + entry=$(printf " %-*d) %-*s [%s]" $num_w $i $max_name "$display_name" $lang) + printf "│%-*s│\n" $inner_w "$entry" + i=$((i + 1)) + done + + printf "│%*s│\n" $inner_w "" + echo "└$(printf '─%.0s' $(seq 1 $inner_w))┘" + exit 1 +fi + +target_name="$1" +shift + +if [[ "$target_name" =~ ^[0-9]+$ ]]; then + sorted=($( + for name in "${!tools[@]}"; do + if [ "${tools[$name]}" = "sh" ]; then + echo "0 $name" + else + echo "1 $name" + fi + done | sort | while read -r _ n; do echo "$n"; done + )) + idx=$((target_name - 1)) + if [ "$idx" -ge 0 ] && [ "$idx" -lt "${#sorted[@]}" ]; then + target_name="${sorted[$idx]}" + else + echo "Error: invalid number '$target_name', valid range is 1-${#sorted[@]}" + exit 1 + fi +fi + +if [ -z "${tools[$target_name]}" ]; then + normalized_user=$(echo "$target_name" | tr '[:upper:]' '[:lower:]' | sed 's/[_. -]//g') + found="" + for existing_name in "${!tools[@]}"; do + normalized_existing=$(echo "$existing_name" | tr '[:upper:]' '[:lower:]' | sed 's/[_. -]//g') + if [ "$normalized_user" = "$normalized_existing" ]; then + found="$existing_name" + break + fi + done + if [ -n "$found" ]; then + target_name="$found" + else + echo "Error: target '$target_name' does not exist" + exit 1 + fi +fi + +type="${tools[$target_name]}" + +case "$type" in + sh) + chmod +x ".run/src/bin/$target_name.sh" + ".run/src/bin/$target_name.sh" "$@" + ;; + binary) + chmod +x ".run/src/bin/$target_name" + ".run/src/bin/$target_name" "$@" + ;; + cs) + temp_dir=".run/target/csproj/$target_name" + mkdir -p "$temp_dir" + cat > "$temp_dir/Directory.Build.props" <<'PROPS' +<Project> + <PropertyGroup> + <BaseOutputPath>$(MSBuildThisFileDirectory)../../csharp/bin</BaseOutputPath> + <BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)../../csharp/obj</BaseIntermediateOutputPath> + </PropertyGroup> +</Project> +PROPS + cat > "$temp_dir/$target_name.csproj" <<'CSPROJ' +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + +</Project> +CSPROJ + cp ".run/src/bin/$target_name.cs" "$temp_dir/Program.cs" + dotnet run --project "$temp_dir/$target_name.csproj" -- "$@" + ;; + go) + go run ".run/src/bin/$target_name.go" "$@" + ;; + nim) + nim r --hints:off ".run/src/bin/$target_name.nim" "$@" + ;; + pl) + perl ".run/src/bin/$target_name.pl" "$@" + ;; + py) + python ".run/src/bin/$target_name.py" "$@" + ;; + rb) + ruby ".run/src/bin/$target_name.rb" "$@" + ;; + rs) + if [ ! -f ".run/Cargo.toml" ]; then + cat > ".run/Cargo.toml" <<'EOF' +[package] +name = "run_rust" +version = "0.1.0" +edition = "2024" + +[workspace] + +[dependencies] +EOF + fi + cargo build --manifest-path ".run/Cargo.toml" --target-dir ".run/target" --bin "$target_name" --quiet + ".run/target/debug/$target_name" "$@" + ;; + zig) + zig run ".run/src/bin/$target_name.zig" "$@" + ;; +esac |
