cargo_zng/
main.rs
1#![doc(html_favicon_url = "https://raw.githubusercontent.com/zng-ui/zng/main/examples/image/res/zng-logo-icon.png")]
2#![doc(html_logo_url = "https://raw.githubusercontent.com/zng-ui/zng/main/examples/image/res/zng-logo.png")]
3#![doc = include_str!(concat!("../", std::env!("CARGO_PKG_README")))]
9#![warn(unused_extern_crates)]
10#![warn(missing_docs)]
11
12#[macro_use]
13mod util;
14mod fmt;
15mod l10n;
16mod new;
17mod res;
18
19pub mod res_tool_util {
23 pub use crate::res::built_in::{
24 ZR_APP, ZR_CACHE_DIR, ZR_CRATE_NAME, ZR_DESCRIPTION, ZR_FINAL, ZR_HELP, ZR_HOMEPAGE, ZR_LICENSE, ZR_ORG, ZR_PKG_AUTHORS,
25 ZR_PKG_NAME, ZR_QUALIFIER, ZR_REQUEST, ZR_REQUEST_DD, ZR_SOURCE_DIR, ZR_TARGET, ZR_TARGET_DD, ZR_TARGET_DIR, ZR_VERSION,
26 ZR_WORKSPACE_DIR, display_path, path,
27 };
28}
29
30use clap::*;
31
32#[derive(Parser)] #[command(name = "cargo")]
34#[command(bin_name = "cargo")]
35enum CargoCli {
36 Zng(Zng),
37}
38
39#[derive(Args, Debug)]
40#[command(author, version, about, long_about = None)]
41#[command(propagate_version = true)]
42struct Zng {
43 #[command(subcommand)]
45 pub command: Command,
46}
47
48#[derive(Subcommand, Debug)]
49enum Command {
50 Fmt(fmt::FmtArgs),
54 New(new::NewArgs),
56 L10n(l10n::L10nArgs),
60
61 Res(res::ResArgs),
66}
67
68fn main() {
69 res::built_in::run();
70
71 let CargoCli::Zng(cli) = CargoCli::parse();
72
73 match cli.command {
74 Command::Fmt(args) => fmt::run(args),
75 Command::New(args) => new::run(args),
76 Command::L10n(args) => l10n::run(args),
77 Command::Res(args) => res::run(args),
78 }
79
80 crate::util::exit();
81}