1#![doc(html_favicon_url = "https://zng-ui.github.io/res/zng-logo-icon.png")]
2#![doc(html_logo_url = "https://zng-ui.github.io/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;
18mod trace;
19
20pub mod res_tool_util {
24 pub use crate::res::built_in::{
25 ZR_APP, ZR_APP_ID, ZR_CACHE_DIR, ZR_CRATE_NAME, ZR_DESCRIPTION, ZR_HELP, ZR_HOMEPAGE, ZR_LICENSE, ZR_ORG, ZR_PKG_AUTHORS,
26 ZR_PKG_NAME, ZR_QUALIFIER, ZR_REQUEST, ZR_REQUEST_DD, ZR_SOURCE_DIR, ZR_TARGET, ZR_TARGET_DD, ZR_TARGET_DIR, ZR_VERBOSE,
27 ZR_VERSION, ZR_WORKSPACE_DIR, display_path, path,
28 };
29}
30
31use clap::*;
32
33#[derive(Parser)] #[command(name = "cargo")]
35#[command(bin_name = "cargo")]
36enum CargoCli {
37 Zng(Zng),
38}
39
40#[derive(Args, Debug)]
41#[command(author, version, about, long_about = None)]
42#[command(propagate_version = true)]
43struct Zng {
44 #[command(subcommand)]
46 pub command: Command,
47
48 #[arg(
50 long,
51 short = 'v',
52 action = clap::ArgAction::Count,
53 global = true,
54 )]
55 verbose: u8,
56}
57
58#[derive(Subcommand, Debug)]
59enum Command {
60 Fmt(fmt::FmtArgs),
64 New(new::NewArgs),
66 L10n(l10n::L10nArgs),
70
71 Res(res::ResArgs),
76
77 Trace(trace::TraceArgs),
81}
82
83fn main() {
84 res::built_in::run();
85
86 let CargoCli::Zng(cli) = CargoCli::parse();
87
88 util::set_verbose(cli.verbose);
89
90 match cli.command {
91 Command::Fmt(args) => fmt::run(args),
92 Command::New(args) => new::run(args),
93 Command::L10n(args) => l10n::run(args),
94 Command::Res(args) => res::run(args),
95 Command::Trace(args) => trace::run(args),
96 }
97
98 crate::util::exit();
99}