Refactor main function to display help message when no command is provided

This commit is contained in:
yhirose committed 2026-03-01 23:04:38 -05:00
1 parent b2d76658fc
commit 2d669c3636
2 files changed
+8 -4

No files matched your search

+6 -2
View File
@@ -4,7 +4,7 @@ mod defaults;
mod markdown;
use anyhow::Result;
use clap::{Parser, Subcommand};
use clap::{Parser, Subcommand, CommandFactory};
use std::fs;
use std::path::{Path, PathBuf};
@@ -49,7 +49,11 @@ fn main() -> Result<()> {
match cli.command {
Some(Command::Build { src, out }) => builder::build(&src, &out),
Some(Command::Init { src }) => cmd_init(&src),
None => builder::build(&cli.src, &cli.out),
None => {
Cli::command().print_help()?;
println!();
Ok(())
}
}
}