From d5740769bae61241515a86504c208e9074688b8a Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Sun, 1 Feb 2026 16:52:22 +0000 Subject: feat: add [VALUE] or to -/-- args in help bump to 2.4 --- ls_args.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'ls_args.h') diff --git a/ls_args.h b/ls_args.h index 36e951c..90b10ce 100644 --- a/ls_args.h +++ b/ls_args.h @@ -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, " \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; } -- cgit