diff options
| author | Lion Kortlepel <[email protected]> | 2026-02-01 16:52:22 +0000 |
|---|---|---|
| committer | Lion Kortlepel <[email protected]> | 2026-02-01 16:52:44 +0000 |
| commit | d5740769bae61241515a86504c208e9074688b8a (patch) | |
| tree | 4fcf1ce7b77c9f1b89dd6166510536a495b4ec5f /ls_args.h | |
| parent | e34787eaa97b60a2ca50052878f0fcdc42818f69 (diff) | |
| download | args-d5740769bae61241515a86504c208e9074688b8a.tar.zst args-d5740769bae61241515a86504c208e9074688b8a.zip | |
feat: add [VALUE] or <VALUE> to -/-- args in helpv2.4
bump to 2.4
Diffstat (limited to 'ls_args.h')
| -rw-r--r-- | ls_args.h | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -1,7 +1,7 @@ /* Lion's Standard (LS) ANSI C commandline argument parser with included help * renderer. * - * Version: 2.3 + * Version: 2.4 * Website: https://libls.org * Repo: https://github.com/libls/args * SPDX-License-Identifier: MIT @@ -763,8 +763,20 @@ char* ls_args_help(ls_args* a) { if (!_lsa_buffer_append_cstr( &help, a->args[i].match.name.long_opt)) goto alloc_fail; - if (!_lsa_buffer_append_cstr(&help, " \t\t")) - goto alloc_fail; + if (a->args[i].type != LS_ARGS_TYPE_BOOL) { + if (!_lsa_buffer_append_cstr(&help, " \t")) + goto alloc_fail; + if (a->args[i].mode == LS_ARGS_REQUIRED) { + if (!_lsa_buffer_append_cstr(&help, "<VALUE> \t")) + goto alloc_fail; + } else { + if (!_lsa_buffer_append_cstr(&help, "[VALUE] \t")) + goto alloc_fail; + } + } else { + if (!_lsa_buffer_append_cstr(&help, " \t\t\t")) + goto alloc_fail; + } if (!_lsa_buffer_append_cstr(&help, a->args[i].help)) goto alloc_fail; } |
