From ece2f4a1d9781d6793efe5b03fa79b5c7a165a42 Mon Sep 17 00:00:00 2001 From: Chris Boone Date: Sat, 16 Dec 2023 10:13:30 -0500 Subject: [PATCH] Improve CLI help --- main.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index dda1a2c..5f28ee2 100644 --- a/main.cpp +++ b/main.cpp @@ -203,16 +203,23 @@ extern "C" { #ifndef EMSCRIPTEN int main(int argc, char *argv[]) { - cxxopts::Options cmd_options("font-maker", "Create font PBFs."); + cxxopts::Options cmd_options("font-maker", "Create font PBFs from TTFs or OTFs."); cmd_options.add_options() - ("output", "Output directory", cxxopts::value()) - ("fonts", "Input fonts TTF or OTF", cxxopts::value>()) + ("output", "Output directory (to be created, must not already exist)", cxxopts::value()) + ("fonts", "Input font(s) (as TTF or OTF)", cxxopts::value>()) ("name", "Override output fontstack name", cxxopts::value()) + ("help", "Print usage") ; + cmd_options.positional_help(" [INPUT_FONT2 ...]"); cmd_options.parse_positional({"output","fonts"}); auto result = cmd_options.parse(argc, argv); + if (result.count("help")) + { + cout << cmd_options.help() << endl; + exit(0); + } if (result.count("output") == 0 || result.count("fonts") == 0) { - cout << "usage: font-maker OUTPUT_DIR INPUT_FONT [INPUT_FONT2 ...]" << endl; + cout << cmd_options.help() << endl; exit(1); } auto output_dir = result["output"].as();