Skip to content

Commit

Permalink
Improve CLI help (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
cboone authored Dec 20, 2023
1 parent c05a752 commit 84f6cb5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>())
("fonts", "Input fonts TTF or OTF", cxxopts::value<vector<string>>())
("output", "Output directory (to be created, must not already exist)", cxxopts::value<string>())
("fonts", "Input font(s) (as TTF or OTF)", cxxopts::value<vector<string>>())
("name", "Override output fontstack name", cxxopts::value<string>())
("help", "Print usage")
;
cmd_options.positional_help("<OUTPUT_DIR> <INPUT_FONT> [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<string>();
Expand Down

0 comments on commit 84f6cb5

Please sign in to comment.