blob: 35ad23ebc7900d9e8de1304629814d5baae4f1e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# Prints a tree of all items in the configuration
import kconfiglib
import sys
def print_with_indent(s, indent):
print (" " * indent) + s
def print_items(items, indent):
for item in items:
if item.is_symbol():
print_with_indent("config {0}".format(item.get_name()), indent)
elif item.is_menu():
print_with_indent('menu "{0}"'.format(item.get_title()), indent)
print_items(item.get_items(), indent + 2)
elif item.is_choice():
print_with_indent('choice', indent)
print_items(item.get_items(), indent + 2)
elif item.is_comment():
print_with_indent('comment "{0}"'.format(item.get_text()), indent)
conf = kconfiglib.Config(sys.argv[1])
print_items(conf.get_top_level_items(), 0)
|