summaryrefslogtreecommitdiff
path: root/scripts/kconfig/example/miniconf.rb
blob: e687fbb5fabc5aa24b436bd339e07b816f31e8d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)