Commit Graph

90 Commits

Author SHA1 Message Date
Martchus d31092b7d9 Apply clang-format 2024-04-08 12:33:57 +02:00
Martchus 7d6fc9721a Apply clang-format/cmake-format 2023-02-03 13:31:18 +01:00
Martchus a5a33bbcef Add missing include for `std::tuple` to `argumentparser.h` 2023-01-31 22:37:06 +01:00
Martchus 38fa3512fd Disable assert for argument name for MSVC to avoid compilation error
Not sure what MSVC complains about here exactly so let's just disable this
code as it is only for debugging anyways.
2023-01-26 22:23:12 +01:00
Martchus 0c6fa07b53 Add `Argument::addSubArguments()` and improve related documentation 2022-08-06 19:14:02 +02:00
Martchus 8f4ca38c69 Update documentation of argument parser 2022-06-26 11:45:13 +02:00
Martchus 3c769fa242 Add greedy-flag for argument parser
This is useful if one needs to pass subsequent arguments as-is to another
nested argument parser.
2022-06-26 11:24:36 +02:00
Martchus b3ebe5ce38 Fix typos found via `codespell --skip .git -w` 2021-07-03 19:07:49 +02:00
Martchus f109d36ad2 Add Argument::firstValueOr() for conveniently accessing the first value with a fallback 2021-01-01 18:30:17 +01:00
Martchus df126ab51c Use std::size_t consistently 2020-11-25 17:51:13 +01:00
Martchus b693c72eb1 Fix old namespaces being mentioned in the documentation 2019-09-04 18:45:28 +02:00
Martchus eb34ce610d Add domain to ApplicationInfo 2019-07-20 20:57:56 +02:00
Martchus fd531bdd6a Prefix most of the macros in global.h 2019-06-12 20:34:25 +02:00
Martchus b48b2f5c06 Have everything in one top-level namespace 2019-06-10 21:56:46 +02:00
Martchus 4c1b733290 Rework ArgumentParser::parseArgs()
* Remove "ext()" and "orExit()" versions
* Exit by default (might be intrusive but it is the most
  common use)
* Rename Failure to ParseError
2019-06-10 16:03:27 +02:00
Martchus 6d2544b908 Return argument parents by reference 2019-06-04 19:08:46 +02:00
Martchus 02bd9f7c06 Add new fields to ApplicationInfo 2019-05-05 18:35:40 +02:00
Martchus b0b92ff1bf Allow marking argument as deprecated 2019-05-04 23:14:43 +02:00
Martchus 6d4e13f2dc Use struct to store global application info 2019-05-04 22:49:57 +02:00
Martchus 04a8ef02d5 Remove deprecated dependencyVersions 2019-05-04 21:44:25 +02:00
Martchus 151a3ae9e5 Apply clang-format 2019-05-04 20:58:23 +02:00
Martchus e9cc26478b Don't mix building static and shared libraries 2019-04-22 20:42:48 +02:00
Martchus 6d7a6ab735 Don't pretent to add arguments implicitely 2019-04-13 20:33:39 +02:00
Martchus cfdfc302db Use exit function passed to argument parser 2019-04-13 20:33:39 +02:00
Martchus 57c896b547 Store boolean properties of Argument as flags 2019-04-13 20:33:39 +02:00
Marius Kittler a7926951cb Make firstPresentUncombinableArg() private 2019-04-13 20:33:39 +02:00
Martchus bc8ea407bc Prevent use of static variables in ArgumentParser
Have --no-color and --help added by default rather
so argument parser is in control over them and don't
has to use static functions.
2019-04-13 20:33:39 +02:00
Martchus 517ef59e14 Prevent livetime issue in ArgumentValueConversionError
Breaking API/ABI is ok since this is part of experimental
ValueConversion namespace.
2018-10-03 22:40:04 +02:00
Martchus 25ef4e28a2 Make tests compile under Windows 2018-09-30 13:55:30 +02:00
Martchus 3d3378c878 Improve experimental value conversion for arg parser
* Fix issues and handle conversion errors
* Add tests
2018-09-22 17:04:23 +02:00
Martchus 651720552e Replace typedef's with using
* Except in code which will be discarded in v5 anyways
* Should not affect source and binary compatibility
2018-09-22 16:41:33 +02:00
Martchus 5e8d8cb7d1 Show dashes in suggestions 2018-05-11 16:15:02 +02:00
Martchus f0b777207e Fix dependency version under GCC 8 2018-05-08 00:35:41 +02:00
Martchus 8ef92cbf47 Use Levenshtein algo to provide suggestions if arg not found 2018-05-07 21:59:23 +02:00
Martchus 872ee49979 Refactor ArgumentParser::printBashCompletion() 2018-05-06 00:26:42 +02:00
Martchus 94e76f5a1a Add experimental methods to convert argument values
* Currently lacks error handling
* Needs testing
2018-04-28 13:07:48 +02:00
Martchus c8bf068e74 Reorder method declarations in Argument and ArgumentParser
So it becomes clear which parts might be moved to a separate class
to prevent Argument from becoming to big.
2018-04-28 12:08:12 +02:00
Martchus 6249db3b09 Remove unused parameter in ArgumentParser::verifyArgs() 2018-03-07 20:04:37 +01:00
Martchus 368fc46e47 Improve tests of argument parser 2018-01-29 16:23:10 +01:00
Martchus 2a797e436d Improve documentation of value completion behaviour 2018-01-29 16:22:26 +01:00
Martchus ad705239b2 Simplify argument parsing 2017-11-29 22:07:45 +01:00
Martchus 424a0bfb6f Add method for parsing args with customizable behavior 2017-11-27 10:25:41 +01:00
Martchus f9e4c74aff argument parser: Expose occurrence info directly
Primarily for testing porposes, see documentation.
2017-11-06 19:50:46 +01:00
Martchus cc09fdc35f Use Argument::varValueCount everywhere 2017-11-06 19:49:39 +01:00
Martchus 6bc97e5b16 Fix API doc (\macro -> \def) 2017-11-06 19:47:17 +01:00
Martchus 9829dbe727 Make use of escape codes configurable 2017-10-17 00:00:46 +02:00
Martchus 6933b7b33e argument parser: Add public accessor for callback 2017-10-16 23:46:21 +02:00
Martchus ee66c56905 Improve documentation 2017-09-30 18:42:34 +02:00
Martchus 46bfbdd829 Allow initialization of values for shell completion in callback
Use case is implementing completion for syncthingctl also for
device and folder IDs.
2017-09-30 18:42:21 +02:00
Martchus 2f5f197b95 Add ArgumentParser::parseArgsOrExit()
to reduce boilerplate code for error handling when
parsing CLI arguments.
2017-09-29 17:14:57 +02:00