Commit Graph

295 Commits

Author SHA1 Message Date
Stephan van Veen
d95f9d9f14 First check for positional, then optional and compound 2019-05-20 22:20:07 +02:00
Stephan van Veen
44bef34e79 Implement parse_args_internal for positional parameters 2019-05-20 22:20:07 +02:00
Stephan van Veen
3c9a74049f Implement parse_args_internal for optional parameters 2019-05-20 22:20:07 +02:00
Stephan van Veen
4da8454a5a Simplify is_optional check 2019-05-18 14:06:46 +02:00
Pranav Srinivas Kumar
c03e34f981
Merge pull request #18 from svanveen/fix/container-types
Unify Argument::get and Argument::operator== for container types
2019-05-14 19:59:31 -04:00
Stephan van Veen
b3494a29d6 Remove is_specialization 2019-05-13 22:53:47 +02:00
Stephan van Veen
20a7d90abe Don't accept std::string as container 2019-05-13 22:52:26 +02:00
Stephan van Veen
a6ceffdb63 Extend doxygen documentation 2019-05-13 22:42:37 +02:00
Stephan van Veen
f08a280f92 Throw std::logic_error instead of returning empty value 2019-05-13 22:42:37 +02:00
Stephan van Veen
02b3ed1878 Cleanup Argument::get methods 2019-05-13 22:42:37 +02:00
Stephan van Veen
ca68260ec4 Enable equality operator for all iterable types 2019-05-13 22:42:36 +02:00
Pranav Srinivas Kumar
bd8d720faa
Merge pull request #16 from Jackojc/fix_const_argv
Allow use of both const char** and char** for argv.
2019-05-12 14:59:12 -04:00
Jack Clarke
3e1a42e312 allow use of const char** and char** for argv 2019-05-12 18:40:30 +01:00
Pranav Srinivas Kumar
6ed4a5157e
Merge pull request #15 from Jackojc/fix_warnings
Fix warning shown with -Wsign-conversion.
2019-05-12 13:15:54 -04:00
Jack Clarke
5e1b85fdc5 fix warning for implicit type conversion 2019-05-12 17:38:18 +01:00
Stephan van Veen
94ca8e2552 Unify container operations 2019-05-12 17:17:21 +02:00
Pranav Srinivas Kumar
cddde9f1b7
Merge pull request #14 from svanveen/fix/refactoring
Do some refactoring to improve readability
2019-05-12 11:05:37 -04:00
Stephan van Veen
15f45c2054 Simplify get method 2019-05-12 15:21:11 +02:00
Stephan van Veen
84adf5b2df Simplify creating of help option 2019-05-12 14:55:45 +02:00
Stephan van Veen
ecf8286c9e Resolve template recursion in add_parents method 2019-05-12 14:55:45 +02:00
Stephan van Veen
3bd7b342f0 Add const 2019-05-12 14:55:45 +02:00
Stephan van Veen
e923cf2ac3 Invert if-condition to improve readability 2019-05-12 14:55:45 +02:00
Stephan van Veen
95746ae159 Put helper methods into anonymous namespace 2019-05-12 14:55:44 +02:00
Stephan van Veen
8dd508d4b6 Put error message into exception instead of std::cerr 2019-05-12 14:55:44 +02:00
Stephan van Veen
603e87ae69 Move validation logic into Argument class itself 2019-05-12 14:55:44 +02:00
Stephan van Veen
7c938b1f2b Use stl algorithms instead of nested for loops 2019-05-12 14:55:44 +02:00
Stephan van Veen
a364f3f1e7 Remove code duplication 2019-05-11 18:46:55 +02:00
Pranav Srinivas Kumar
50f2df36aa
Merge pull request #13 from svanveen/fix/exceptions
Replaced exit(0) by std::runtime_error
2019-05-11 09:24:56 -04:00
Stephan van Veen
12ad27f9c3 Don't call print_help inside ArgumentParser 2019-05-11 13:11:49 +02:00
Stephan van Veen
42ff186743 Put error message into exception instead of printing 2019-05-11 12:51:56 +02:00
Stephan van Veen
3c65c5dcab Add MACRO which calls exit(0) on any runtime_error in parse_args 2019-05-11 11:24:41 +02:00
Stephan van Veen
a0fa02503e Throw std::runtime_error instead of calling exit(0) 2019-05-11 11:23:44 +02:00
Stephan van Veen
94e4458641 Make use of move semantics 2019-05-11 00:58:20 +02:00
Pranav Srinivas Kumar
16ef9d84e0
Merge pull request #12 from svanveen/feature/modernize
Modernize code
2019-05-10 17:59:55 -04:00
Stephan van Veen
b1c566b434 Prefer emplace_back over push_back 2019-05-10 19:11:43 +02:00
Stephan van Veen
6d3be1927c Use new constructor of Argument in constructor of ArgumentParser 2019-05-10 17:20:12 +02:00
Stephan van Veen
10fab58969 Replace upsert method by std::map::insert_or_assign 2019-05-10 17:06:28 +02:00
Stephan van Veen
91cd2477de Fix broken indentation 2019-05-09 20:31:10 +02:00
Stephan van Veen
2dc9121acf Simplify type traits 2019-05-09 18:44:47 +02:00
Stephan van Veen
df21d07bd6 Prefer emplace_back over push_back 2019-05-09 18:44:46 +02:00
Stephan van Veen
bef90a8d4f Make use of move semantics 2019-05-09 18:44:46 +02:00
Stephan van Veen
1eadf94438 Use empty() instead of size comparison 2019-05-09 18:44:46 +02:00
Stephan van Veen
d57b191f77 Use range based for loop 2019-05-09 18:44:46 +02:00
Stephan van Veen
89e4bb11ac Use auto type for iterators 2019-05-09 18:44:46 +02:00
Stephan van Veen
328f1048da Initialize mNames using 2019-05-09 18:44:46 +02:00
Stephan van Veen
d9bff3dc2b Construct Argument using template pack of names 2019-05-09 18:44:46 +02:00
Stephan van Veen
8474147a7c Use default constructor and non-static member initializers 2019-05-09 18:44:46 +02:00
Pranav Srinivas Kumar
f13f538f8c
Merge pull request #11 from Jackojc/fix_warnings
Fix some warnings
2019-05-07 19:09:19 -04:00
Jack Clarke
4448983ecf fixed warnings 2019-05-07 17:04:48 +01:00
Pranav Srinivas Kumar
3ea4c79137 Fixes core dump on optional arg (issue #10) 2019-05-04 11:49:30 -04:00