mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-04-11 19:28:30 +00:00
Refactor main function to display help message when no command is provided
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
justfile
4
justfile
@@ -47,9 +47,9 @@ bench:
|
||||
|
||||
docs:
|
||||
cargo build --release --manifest-path docs-gen/Cargo.toml
|
||||
./docs-gen/target/release/docs-gen docs-src --out docs
|
||||
./docs-gen/target/release/docs-gen build docs-src --out docs
|
||||
|
||||
docs-test:
|
||||
cargo build --release --manifest-path docs-gen/Cargo.toml
|
||||
./docs-gen/target/release/docs-gen docs-src --out test/cpp-httplib
|
||||
./docs-gen/target/release/docs-gen build docs-src --out test/cpp-httplib
|
||||
cd test && python3 -m http.server
|
||||
|
||||
Reference in New Issue
Block a user