Commit Graph

132 Commits

Author SHA1 Message Date
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 89a4c2f33a Skip suggestions for pre-defined values if none assigned 2018-05-11 18:13:14 +02:00
Martchus b69b841fa3 Prevent huge memory allocation for Damerau-Levenshtein algo 2018-05-11 16:15:16 +02:00
Martchus 5e8d8cb7d1 Show dashes in suggestions 2018-05-11 16:15:02 +02:00
Martchus 24720bbbc1 Fix passing cursor position to findSuggestions() 2018-05-11 15:51:30 +02:00
Martchus 5eb3e2aa75 Fix suggestion if only one available 2018-05-11 15:29:10 +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 44f0206a13 Refactor ArgumentReader::read()
* Use return-code for error handling
* Improve documentation/comments
* Improve const correctness
2018-05-07 20:04:30 +02:00
Martchus 0e8dcbecae Refactor value completion in ArgumentParser::printBashCompletion() 2018-05-06 00:36:37 +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 55649d750a Fix calling verifyArgs() 2018-03-11 14:31:10 +01: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 8c42a4644b Simplify ArgumentParser::readArgs() 2018-01-29 16:21:19 +01:00
Martchus ff5eb6c7c9 Do not show help for --help 2018-01-28 00:43:03 +01:00
Martchus 09f9181281 Split operations from other top-level args in --help 2018-01-28 00:38:05 +01:00
Martchus a3192a1113 Fix parsing top-level argument after abbreviation 2017-11-29 22:52:50 +01:00
Martchus ad705239b2 Simplify argument parsing 2017-11-29 22:07:45 +01:00
Martchus a16b056dc3 Fix reading value after abbreviation and equation sign 2017-11-29 20:23:15 +01:00
Martchus 8aff877874 Fix comparing sibling name with denoted name 2017-11-27 10:30:14 +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 3c16d2beb8 Export determineTerminalSize() correctly 2017-10-30 22:34:10 +01:00
Martchus 60e4fead05 Deprecate FakeQtConfigArguments 2017-10-25 19:32:45 +02:00
Martchus ba620c5e0a Apply clang-format 2017-10-19 01:07:38 +02:00
Martchus 46f652ad00 Improve readability of ArgumentReader::read and use Phrases 2017-10-19 00:51:47 +02:00
Steven Penny e07782ae16 commandlineutils.cpp: correct rows and columns
From here:

http://docs.microsoft.com/windows/console/coord-str

- X is columns
- Y is rows

currently that is reversed with the codebase
2017-10-16 18:04:35 -05: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 cf09db8166 Export ostream &operator<<(std::ostream&,const Failure&failure) 2017-10-07 23:02:29 +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 b7b218c831 Wrap strings which are likely long when printing help
to preserve indentation
2017-09-29 21:00:49 +02:00
Martchus 6e80640db5 Add method to determine terminal size 2017-09-29 20:56:50 +02:00
Martchus 027e784f1c Only make extra newline before example for top-level args 2017-09-29 20:56:13 +02:00
Martchus 8750e385f1 Improve doc for ArgumentParser::parseArgs()/readArgs() 2017-09-29 17:15:39 +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
Martchus 1c450d43a2 Add method to find specified operation 2017-09-26 16:46:17 +02:00
Martchus a1d6c3ba7b Make invokeCallbacks() static as no members used 2017-09-26 16:44:22 +02:00
Martchus 37a84d64f1 Fix warnings about use of NULL in startConsole()
Can't fix warnings about old-style casts because those
macros are defined in windows headers.
2017-09-24 19:57:13 +02:00
Martchus e52fd5a4af Apply tidy after updating to clang-format 5.0.0
The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2017-09-17 21:45:23 +02:00