Skip to content

Commit

Permalink
changes to help of subncall
Browse files Browse the repository at this point in the history
  • Loading branch information
riasc committed Nov 14, 2024
1 parent cf4a0df commit 000e618
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cli/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ std::unique_ptr<Subcall> createSubcall(const std::string& subcall) {
void printGeneralHelp(cxxopts::Options& options) {
std::cout << options.help() << "\n";
std::cout << "Available subcommands: \n";
std::cout << "\tindex:\tIndex an Interval File\n";
std::cout << "\tindex:\t\tIndex an Interval File\n";
std::cout << "\toverlap:\tSearch for interval overlaps in the index\n";
std::cout << "For more details on a subcommand, use the --help option with the subcommand.\n";
}
Expand All @@ -39,15 +39,11 @@ int main(int argc, char** argv) {
auto args = options.parse(argc, argv);

// check if the help option was selected (on the main level)
if(args.count("help") || !args.count("subcall")) {
std::cout << options.help() << std::endl;
return 0;
}

if(!args.count("subcall")) {
std::cerr << "Error: No subcommand has been specified.\n";
std::cerr << options.help() << std::endl;
return 1;
if(args.count("help")) {
if(!args.count("subcall")) {
printGeneralHelp(options);
return 0;
}
}

std::string subcall = args["subcall"].as<std::string>();
Expand All @@ -61,6 +57,10 @@ int main(int argc, char** argv) {

// parse additional options for the subcommand
auto subcallArgs = command->parseArgs(argc, argv);
if(subcallArgs.count("help")) {

command->printHelp(options);
return 0;
}
}

0 comments on commit 000e618

Please sign in to comment.