Skip to content

Commit

Permalink
Merge pull request #41 from yuma140902/add-command-help
Browse files Browse the repository at this point in the history
feat(help): add help message for subcommands
  • Loading branch information
yuma140902 authored Oct 15, 2023
2 parents 1c4e200 + fe65ea5 commit 2a2612c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ keywords = ["ssg", "templating", "web", "markdown"]

[dependencies]
anyhow = "1.0.75"
clap = { version = "4.4.6", features = ["derive"] }
clap = { version = "4.4.6", features = ["derive", "help"] }
handlebars = "4.4.0"
matter = "0.1.0-alpha4"
once_cell = "1.18.0"
Expand Down
11 changes: 10 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,27 @@ use std::path::PathBuf;
use clap::{Parser, Subcommand};

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None, help_template = "\
{before-help}{name} {version}
{tab}by {author}
{about-with-newline}
{usage-heading} {usage}
{all-args}{after-help}
")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}

#[derive(Subcommand, Debug)]
pub enum Commands {
/// Initializes a Tempura project
Init {
#[arg(default_value = ".")]
directory: PathBuf,
},
/// Builds website
Build {
#[arg(default_value = ".")]
directory: PathBuf,
Expand Down

0 comments on commit 2a2612c

Please sign in to comment.