Martchus
d31092b7d9
Apply clang-format
2024-04-08 12:33:57 +02:00
Martchus
f97320816a
Change Bash completion code for dirs/files to new coding style
2023-12-29 16:34:26 +01:00
Martchus
6f924da4f0
Make code for processing escaping in Bash completion more generic
2023-12-29 16:30:55 +01:00
Martchus
b3b7166812
Fix bash completion when path contains round brackets
2023-12-29 16:09:55 +01:00
Martchus
66b6fff0f2
Fix greediness of greedy arguments if they have sub arguments
...
Even sub arguments (e.g. `--help`) should be treated as values to be passed
to a nested argument parser (as documented). The sub arguments are only
added in this case to appear in the help.
2023-05-29 18:09:34 +02:00
Martchus
5bfce4235e
Fix typo
2023-05-29 18:05:11 +02:00
Martchus
a19ee41a39
Apply cmake-format and clang-format
2023-05-16 21:39:10 +02:00
Martchus
0d0685d4c7
Simplify workaround for starting console and CLI-wrapper
...
* Disable workaround by default; with the CLI-wrapper available it makes no
sense to run this code unnecassarily when the main executable is invoked
* Remove check for Mintty; with the workaround disabled by default it
is no longer necassary to avoid it
* Simplify the CLI-wrapper to rely on main application for enabling UTF-8
and virtual terminal processing as it relies on it for attaching to the
parent's console anyways
2023-05-09 00:16:28 +02:00
Martchus
caace3ac63
Improve workaround for starting console from GUI app
...
It is still not perfect but now at least:
* Redirections to a file and pipes are no longer broken with `cmd.exe`
* Pipes are no longer broken in PowerShell
* It works at all when using MSVC
* The whole workaround is skipped for Mintty (as it is not needed at all)
* Sending a return key to the terminal in the end has been removed as it
caused more harm than good in certain terminals and did not work in
terminals other than `cmd.exe` anyways
2023-05-07 20:39:22 +02:00
Martchus
5e325d0b92
Avoid unqualified call to `std::move`
2023-05-05 01:06:06 +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
da830dcef5
Apply clang-format and cmake-format
2023-01-28 20:20:47 +01:00
Martchus
d1eeae83c6
Fix includes for command-line utilities
...
Most importantly, import `io.h` under Windows as it is required for using
`_open_osfhandle`.
2023-01-26 22:26:42 +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
d8c38699ba
Avoid warning about unqualified std cast
2022-11-04 16:50:13 +01:00
Martchus
0cf59b654b
Make `isEnvVariableSet()` public API
2022-10-08 22:29:32 +02: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
b1b811c57f
Apply clang-format
2022-06-26 11:04:23 +02:00
Martchus
9e036a3f72
Allow enabling virtual terminal processing under Windows
...
* or disable use of ANSI-escape codes if not possible
* See https://github.com/Martchus/syncthingtray/issues/132
2022-06-07 16:46:54 +02:00
Martchus
cf510f0397
Use macros from cstdlib instead of hard-coding exit codes
2022-05-21 12:37:36 +02:00
Martchus
b3ebe5ce38
Fix typos found via `codespell --skip .git -w`
2021-07-03 19:07:49 +02:00
Martchus
1ac1104535
Add workaround for Windows-specific console problems
...
* Allow disabling the hack for creating a console for
a GUI application via `ENABLE_CONSOLE=0` to workaround
downsides of this hack (pipes not working, possibly
spawns an additional console)
* Set the console's character set to UTF-8 by default
because this actually seems to work now and
non-ASCII characters are displayed correctly. There
is still an opt-out via `ENABLE_CP_UTF8=0`.
* Note that with mintty it just works anyways so using
that terminal emulator is still the best workaround.
2021-05-28 19:15:09 +02:00
Martchus
b22a600e77
Fix broken code in ArgumentParser::printBashCompletion() leading to crashes
...
See https://github.com/Martchus/cpp-utilities/issues/19#issuecomment-839758443
2021-05-12 17:52:36 +02:00
Martchus
f30947cc75
Fix plural of parameter
2021-03-30 20:48:05 +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
53b4cbd8e9
Make fake Qt arguments operations
2020-04-05 21:40:01 +02:00
Martchus
eadb261c56
Ignore file system errors when printing bash completion
2020-01-29 19:27:32 +01:00
Martchus
0f56d25251
Use consistent order for visibility attribute
2020-01-29 18:30:02 +01:00
Martchus
d76d78ae71
Fix childs -> children
2019-12-30 22:52:23 +01:00
Martchus
23b774e374
Update ArgumentParser::parseArgs()/readArgs() documentation
2019-09-14 20:53:25 +02:00
Martchus
9cc6be4d4c
Suppress "Available top-level options:" if none available
2019-09-14 20:52:35 +02:00
Martchus
ecdebebab8
Exclude private structs from documentation
2019-09-04 18:51:17 +02:00
Martchus
ae2f25f3f4
Use consistent include guards for application utilities
2019-09-04 18:45:48 +02:00
Martchus
b693c72eb1
Fix old namespaces being mentioned in the documentation
2019-09-04 18:45:28 +02:00
Martchus
43d2d280e1
Fix Bash completion for dirs when not using actual dir
2019-09-04 18:26:37 +02:00
Martchus
780ba7bc18
Show description in --help
2019-07-22 18:17:39 +02:00
Martchus
eb34ce610d
Add domain to ApplicationInfo
2019-07-20 20:57:56 +02:00
Martchus
1be20da35a
Make use of std::filesystem optional
...
It is not available under Android yet and only used for
Bash completion. So make it optional to support Android by
disabling that part of the Bash completion which is not
useful under Android anyways.
2019-07-02 18:40:25 +02:00
Martchus
f098a83a18
Fix namespace in Windows-specific macros
2019-06-20 22:55:29 +02:00
Martchus
fd531bdd6a
Prefix most of the macros in global.h
2019-06-12 20:34:25 +02:00
Martchus
4e2539548d
Remove FALLTHROUGH macro
...
Since this is requiring C++17 anyways there's no need for
it anymore.
2019-06-12 20:33:43 +02:00
Martchus
b48b2f5c06
Have everything in one top-level namespace
2019-06-10 21:56:46 +02:00
Martchus
d9e498ba79
Remove DECLARE_ENUM and DECLARE_ENUM_CLASS
...
lupdate seems to be fixed since quite a while now.
2019-06-10 16:20:56 +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
1ad90eb770
Use std::filesystem in argumentparser.cpp
2019-06-05 23:49:35 +02:00
Martchus
6d2544b908
Return argument parents by reference
2019-06-04 19:08:46 +02:00