You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was playing with this library and made the following in main.cpp:
#include<iostream>
#include<fstream>
#include<vector>
#include"argparse.h"intmain (int argc, constchar * argv[])
{
std::cout << "Hi" << std::endl;
argparse::ArgumentParser parser ("test", "idkwhatthisdoes");
parser.add_argument ()
.names ({"-q", "--query"})
.description ("Define search query for what to look for")
.required (true)
.position (0);
parser.add_argument ()
.names ({"-i", "--input-file"})
.description ("Specifies the input file")
.required (true)
.position (1);
parser.add_argument ()
.names ({"-o", "--output-file"})
.description ("Specifies the output file")
.required (true)
.position (2);
parser.add_argument ()
.names ({"-u", "--username"})
.description ("Specifies the username to search. If empty username search will be ignored")
.required (false);
parser.enable_help ();
auto err = parser.parse (argc, argv);
if (err)
{
std::cout << err << std::endl;
return -1;
}
if (parser.exists("help"))
{
parser.print_help();
return0;
}
if (parser.exists("q"))
{
std::cout << "woah query" << parser.get<std::string>("q") << std::endl;
return0;
}
return0;
}
Running ./main -h gives me:
$ ./build/mtcs -h
Hi
Usage: test [q] [1] [i] [2] [o] [options...]
Options:
-q, --query Define search query for what to look for (Required)
-i, --input-file Specifies the input file (Required)
-o, --output-file Specifies the output file (Required)
-u, --username Specifies the username to search. If empty username search will be ignored
-h, --help Shows this page
But I expect:
$ ./build/mtcs -h
Hi
Usage: test [q] [i] [o] [options...]
Options:
-q, --query Define search query for what to look for (Required)
-i, --input-file Specifies the input file (Required)
-o, --output-file Specifies the output file (Required)
-u, --username Specifies the username to search. If empty username search will be ignored
-h, --help Shows this page
Why do numbers appear between arguments?
The text was updated successfully, but these errors were encountered:
I was playing with this library and made the following in
main.cpp
:Running
./main -h
gives me:But I expect:
Why do numbers appear between arguments?
The text was updated successfully, but these errors were encountered: