summaryrefslogtreecommitdiff
path: root/scripts/kconfig/example/miniconf.rb
Side-by-side diff
Diffstat (limited to 'scripts/kconfig/example/miniconf.rb') (more/less context) (show whitespace changes)
-rw-r--r--scripts/kconfig/example/miniconf.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/kconfig/example/miniconf.rb b/scripts/kconfig/example/miniconf.rb
new file mode 100644
index 0000000..e687fbb
--- a/dev/null
+++ b/scripts/kconfig/example/miniconf.rb
@@ -0,0 +1,32 @@
+require "kconfig"
+
+include Kconfig
+
+conf_parse("arch/i386/Kconfig")
+conf_read(nil)
+
+def conf(menu)
+ return unless menu.isVisible?
+ prompt = menu.prompt
+ if prompt.type == P_COMMENT || prompt.type == P_MENU
+ print "* #{prompt.text}\n"
+ end
+ sym = menu.sym
+ if sym
+ begin
+ print "#{prompt.text} (#{sym.get_string})? "
+ unless sym.isChangable?
+ print "\n"
+ break
+ end
+ val = gets.strip
+ end until val.empty? || sym.set_string(val)
+ end
+ menu.each do |child|
+ conf(child)
+ end
+end
+
+conf(Kconfig.rootmenu)
+
+conf_write(nil)