Closed xiaodaxia-2008 closed 2 years ago
If adding an int type argument and given a negative number, it cannot work as expected.
#include <fmt/format.h> #include <Svar/Svar.h> int main(int argc, char **argv) { svar.parseMain(argc, argv); svar.arg<int>("n", 1, "int number"); if (svar.get<bool>("help", false)) { return svar.help(); } int n = svar.get<int>("n", 1); fmt::print("n is {}\n", n); return 0; }
If call with -n -5,it seems to parse -5 as another argument name, but not the number that representing n. And it works well for number >= 0.
-n -5
-5
n
➜ build ./bin/main -n -5 n is 1
Yes it is a kown issue, now it is fixed in pull #13 , thanks for the issue reporting.
If adding an int type argument and given a negative number, it cannot work as expected.
If call with
-n -5
,it seems to parse-5
as another argument name, but not the number that representingn
. And it works well for number >= 0.