Skip to content

Commit

Permalink
Update help menu
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamRagstad committed Apr 2, 2024
1 parent fe7b207 commit 8f5e72a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "webx"
version = "1.0.0"
edition = "2021"
description = "A language and framework for building web server backends."
description = "A language and framework for building backends."
authors = ["William Rågstad"]
homepage = "https://webx.sh"
documentation = "https://webx.sh/docs"
Expand Down
36 changes: 24 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ fn cli() -> Command {
.short('p')
.long("prod")
.action(ArgAction::SetTrue)
.help("Run in production mode"))
.help("Run in production mode"),
)
.arg(
Arg::new("level")
.short('l')
.long("level")
.required(false)
.help("Set the debug verbosity level [1-4], default: 2")),
.help("Set the debug verbosity level [1-4], default: 2"),
),
)
.subcommand(
Command::new("new")
Expand All @@ -44,11 +46,13 @@ fn cli() -> Command {
.help("The name of the project")
.required(true),
)
.arg(Arg::new("override")
.short('o')
.long("override")
.action(ArgAction::SetTrue)
.help("Override existing files")),
.arg(
Arg::new("override")
.short('o')
.long("override")
.action(ArgAction::SetTrue)
.help("Override existing files"),
),
)
.subcommand(
Command::new("test")
Expand All @@ -62,13 +66,21 @@ fn cli() -> Command {
),
)
.color(clap::ColorChoice::Auto)
.override_usage(format!("{name} [command] (options)", name = NAME.bright_white()))
.override_usage(format!(
"{name} [command] (options)",
name = NAME.bright_white()
))
.help_template(format!(
"{info} - {{about}}\n{author} \n\n{{usage-heading}} {{usage}} \n\n{{all-args}} {{after-help}}",
info = "{name} {version}".bright_white(),
author = "Created by {author}".italic().bright_black()
"{info} - {{about}}\n\n{{usage-heading}} {{usage}} \n\n{{all-args}} {{after-help}}",
info = "WebX".bright_white(),
))
.after_help(format!(
"{}{}\n{}{}",
"Version: ".bright_black(),
VERSION.bright_black(),
"More information on ".bright_black(),
env!("CARGO_PKG_HOMEPAGE").bright_black()
))
.after_help(format!("{}{}", "More information on ".bright_black(), env!("CARGO_PKG_HOMEPAGE").bright_black()))
}

fn parse_debug_level(matches: &clap::ArgMatches) -> DebugLevel {
Expand Down

0 comments on commit 8f5e72a

Please sign in to comment.