This crate is part of the [`zng`](https://github.com/zng-ui/zng?tab=readme-ov-file#crates) project. Cargo extension for Zng project management. Create a new project from templates, collect localization strings, package the application for distribution. # Installation ```console cargo install cargo-zng ``` # Usage Commands overview: ```console $ cargo zng --help Zng project manager. Usage: cargo zng Commands: fmt Format code and macros new New project from a Zng template repository l10n Localization text scraper res Build resources help Print this message or the help of the given subcommand(s) Options: -h, --help Print help -V, --version Print version ``` ## `fmt` Formats the code with `cargo fmt` and formats Zng macros and some other braced macros. ```console $ cargo zng fmt --help Format code and macros Runs cargo fmt and formats Zng macros Usage: cargo zng fmt [OPTIONS] Options: --check Only check if files are formatted --manifest-path Format the crate identified by Cargo.toml -p, --package Format the workspace crate identified by package name -f, --files Format all files matched by glob -s, --stdin Format the stdin to the stdout -h, --help Print help (see a summary with '-h') -V, --version Print version ``` The formatter supports Zng macros and also attempts to format all braced macro contents like `foo! { }` by copying it into a temporary item `fn _fmt_item() { }` and trying `rustfmt`, if the contents cannot be formatted like this they are not touched. ### IDE Integration You can configure Rust-Analyzer to use `cargo zng fmt --stdin` as your IDE formatter. In VsCode add this to the workspace config at `.vscode/settings.json`: ```json "rust-analyzer.rustfmt.overrideCommand": [ "cargo", "zng", "fmt", "--stdin" ], ``` Now Zng macros format with the format context action and command. ## `new` Initialize a new repository from a Zng template repository. ```console $ cargo zng new --help New project from a Zng template repository Usage: cargo zng new [OPTIONS] [VALUE]... Arguments: [VALUE]... Set template values by position The first value for all templates is the app name. EXAMPLE cargo zng new "My App!" | creates a "my-app" project. cargo zng new "my_app" | creates a "my_app" project. Options: -t, --template