[RFC 1/2] kconfig: Add helpallconfig
From: Markus Schneider-Pargmann
Date: Wed Mar 27 2024 - 11:05:48 EST
To support a possible fzf driven kconfig script, all config symbols need
to be printed. As helpnewconfig already provides a very similar list,
this patch extends that functionality to print all config symbols with a
new command called helpallconfig.
Signed-off-by: Markus Schneider-Pargmann <msp@xxxxxxxxxxxx>
---
scripts/kconfig/Makefile | 4 +++-
scripts/kconfig/conf.c | 17 +++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index ea1bf3b3dbde..87df82c03afb 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -77,7 +77,8 @@ localyesconfig localmodconfig: $(obj)/conf
# deprecated for external use
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
alldefconfig randconfig listnewconfig olddefconfig syncconfig \
- helpnewconfig yes2modconfig mod2yesconfig mod2noconfig
+ helpallconfig helpnewconfig yes2modconfig mod2yesconfig \
+ mod2noconfig
PHONY += $(simple-targets)
@@ -147,6 +148,7 @@ help:
@echo ' mod2yesconfig - Change answers from mod to yes if possible'
@echo ' mod2noconfig - Change answers from mod to no if possible'
@echo ' listnewconfig - List new options'
+ @echo ' helpallconfig - List all options and help text'
@echo ' helpnewconfig - List new options and help text'
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
@echo ' default value without prompting'
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index b5730061872b..3abc5f6b3a27 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -32,6 +32,7 @@ enum input_mode {
defconfig,
savedefconfig,
listnewconfig,
+ helpallconfig,
helpnewconfig,
olddefconfig,
yes2modconfig,
@@ -633,13 +634,14 @@ static void check_conf(struct menu *menu)
struct symbol *sym;
struct menu *child;
- if (!menu_is_visible(menu))
+ if (input_mode != helpallconfig && !menu_is_visible(menu))
return;
sym = menu->sym;
- if (sym && !sym_has_value(sym) &&
- (sym_is_changeable(sym) ||
- (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes))) {
+ if (input_mode == helpallconfig ||
+ (sym && !sym_has_value(sym) &&
+ (sym_is_changeable(sym) ||
+ (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)))) {
switch (input_mode) {
case listnewconfig:
@@ -647,6 +649,7 @@ static void check_conf(struct menu *menu)
print_symbol_for_listconfig(sym);
break;
case helpnewconfig:
+ case helpallconfig:
printf("-----\n");
print_help(menu);
printf("-----\n");
@@ -678,6 +681,7 @@ static const struct option long_opts[] = {
{"alldefconfig", no_argument, &input_mode_opt, alldefconfig},
{"randconfig", no_argument, &input_mode_opt, randconfig},
{"listnewconfig", no_argument, &input_mode_opt, listnewconfig},
+ {"helpallconfig", no_argument, &input_mode_opt, helpallconfig},
{"helpnewconfig", no_argument, &input_mode_opt, helpnewconfig},
{"olddefconfig", no_argument, &input_mode_opt, olddefconfig},
{"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig},
@@ -696,6 +700,7 @@ static void conf_usage(const char *progname)
printf("\n");
printf("Mode options:\n");
printf(" --listnewconfig List new options\n");
+ printf(" --helpallconfig List all options and help text\n");
printf(" --helpnewconfig List new options and help text\n");
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
printf(" --oldconfig Update a configuration using a provided .config as base\n");
@@ -783,6 +788,7 @@ int main(int ac, char **av)
case oldaskconfig:
case oldconfig:
case listnewconfig:
+ case helpallconfig:
case helpnewconfig:
case olddefconfig:
case yes2modconfig:
@@ -888,6 +894,9 @@ int main(int ac, char **av)
check_conf(&rootmenu);
} while (conf_cnt);
break;
+ case helpallconfig:
+ check_conf(&rootmenu);
+ break;
case olddefconfig:
default:
break;
--
2.43.0