]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/c.h: add USAGE_LIST_COLUMNS_OPTION() macro
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Fri, 10 Oct 2025 23:17:42 +0000 (19:17 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Fri, 10 Oct 2025 23:51:24 +0000 (19:51 -0400)
With this new macro we no longer have to redundantly specify
`fputs(_(" -H, --list-columns...` in the usage() function of ls-like tools, as it
will be consolidated to the USAGE_LIST_COLUMNS_OPTION() macro.

USAGE_LIST_COLUMNS_OPTION() aligns the option description to the other descriptions
in the usage() output in the same way as USAGE_HELP_OPTIONS().

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
include/c.h

index c4c73ce9df045069fc641473cdcec709ea5d03d1..f7cd08fd8bb90e8e2f0d783f90cd215dca3be2f8 100644 (file)
@@ -516,8 +516,13 @@ static inline void __attribute__((__noreturn__)) ul_sig_err(int excode, const ch
 #define USAGE_DEFAULT_COLUMNS _("\nDefault columns:\n")
 #define USAGE_SEPARATOR    "\n"
 
-#define USAGE_OPTSTR_HELP     _("display this help")
-#define USAGE_OPTSTR_VERSION  _("display version")
+#define USAGE_OPTSTR_LIST_COLUMNS  _("list the available columns")
+#define USAGE_OPTSTR_HELP          _("display this help")
+#define USAGE_OPTSTR_VERSION       _("display version")
+
+#define USAGE_LIST_COLUMNS_OPTION(marg_dsc) \
+               "%-" #marg_dsc "s%s\n" \
+               , " -H, --list-columns",    USAGE_OPTSTR_LIST_COLUMNS
 
 #define USAGE_HELP_OPTIONS(marg_dsc) \
                "%-" #marg_dsc "s%s\n" \