Skip to content

Commit

Permalink
Update examples from exit() to std::exit()
Browse files Browse the repository at this point in the history
argparse seems to use the "std::" qualifier for std namespace members,
continue that in the documentation.

Signed-off-by: Sean Robinson <[email protected]>
  • Loading branch information
skrobinson committed Oct 27, 2021
1 parent c9e2958 commit 8772b37
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto input = program.get<int>("square");
Expand Down Expand Up @@ -103,7 +103,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

if (program["--verbose"] == true) {
Expand Down Expand Up @@ -169,7 +169,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto color = program.get<std::string>("--color"); // "orange"
Expand All @@ -192,7 +192,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto colors = program.get<std::vector<std::string>>("--color"); // {"red", "green", "blue"}
Expand Down Expand Up @@ -222,7 +222,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

// Some code to print arguments
Expand Down Expand Up @@ -255,7 +255,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

int input = program.get<int>("square");
Expand Down Expand Up @@ -314,7 +314,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto files = program.get<std::vector<std::string>>("--input_files"); // {"config.yml", "System.xml"}
Expand Down Expand Up @@ -343,7 +343,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto query_point = program.get<std::vector<double>>("--query_point"); // {3.5, 4.7, 9.2}
Expand Down Expand Up @@ -375,7 +375,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}
auto a = program.get<bool>("-a"); // true
Expand Down Expand Up @@ -459,7 +459,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

try {
Expand Down Expand Up @@ -506,7 +506,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto output_filename = program.get<std::string>("-o");
Expand Down Expand Up @@ -588,7 +588,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}
nlohmann::json config = program.get<nlohmann::json>("config");
Expand Down Expand Up @@ -624,7 +624,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto numbers = program.get<std::vector<int>>("numbers"); // {1, 2, 3}
Expand Down Expand Up @@ -666,7 +666,7 @@ try {
catch (const std::runtime_error& err) {
std::cout << err.what() << std::endl;
std::cout << program;
exit(0);
std::exit(0);
}

auto input = program.get("input");
Expand Down

0 comments on commit 8772b37

Please sign in to comment.