From 89cecb188d3905ecf98f2a6be93cbd7cf6bf8a64 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 15 Oct 2024 13:55:55 +0200 Subject: Greet users who run `typst` for the first time (#5210) --- crates/typst-cli/src/args.rs | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'crates/typst-cli/src/args.rs') diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs index 65259ab7..7436d25c 100644 --- a/crates/typst-cli/src/args.rs +++ b/crates/typst-cli/src/args.rs @@ -13,9 +13,36 @@ use semver::Version; /// in environment variables. const ENV_PATH_SEP: char = if cfg!(windows) { ';' } else { ':' }; -/// The Typst compiler. +/// The overall structure of the help. +#[rustfmt::skip] +const HELP_TEMPLATE: &str = "\ +Typst {version} + +{usage-heading} {usage} + +{all-args}{after-help}\ +"; + +/// Adds a list of useful links after the normal help. +#[rustfmt::skip] +const AFTER_HELP: &str = color_print::cstr!("\ +Resources: + Tutorial: https://typst.app/docs/tutorial/ + Reference documentation: https://typst.app/docs/reference/ + Templates & Packages: https://typst.app/universe/ + Forum for questions: https://forum.typst.app/ +"); + +/// The Typst compiler #[derive(Debug, Clone, Parser)] -#[clap(name = "typst", version = crate::typst_version(), author)] +#[clap( + name = "typst", + version = crate::typst_version(), + author, + help_template = HELP_TEMPLATE, + after_help = AFTER_HELP, + max_term_width = 80, +)] pub struct CliArguments { /// The command to run #[command(subcommand)] -- cgit v1.2.3