Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools: ynl: cli: make the output compact

Make the default (non-JSON) output more compact. Looking at RSS
context dumps is pretty much impossible without this, because
default print shows the indirection table with line per entry:

'indir': [0,
1,
2,
...

And indirection tables have 100-200 entries each.

The compact output is far more readable:

'indir': [0, 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,

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20260131203029.1173492-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+6 -3
+6 -3
tools/net/ynl/pyynl/cli.py
··· 44 44 return f"{modifiers}{text}{Colors.RESET}" 45 45 return text 46 46 47 + def term_width(): 48 + """ Get terminal width in columns (80 if stdout is not a terminal) """ 49 + return shutil.get_terminal_size().columns 50 + 47 51 def schema_dir(): 48 52 """ 49 53 Return the effective schema directory, preferring in-tree before ··· 107 103 108 104 if attr.yaml.get('doc'): 109 105 doc_prefix = prefix + ' ' * 4 110 - term_width = shutil.get_terminal_size().columns 111 - doc_text = textwrap.fill(attr.yaml['doc'], width=term_width, 106 + doc_text = textwrap.fill(attr.yaml['doc'], width=term_width(), 112 107 initial_indent=doc_prefix, 113 108 subsequent_indent=doc_prefix) 114 109 attr_info += f"\n{doc_text}" ··· 267 264 if args.output_json: 268 265 print(json.dumps(msg, cls=YnlEncoder)) 269 266 else: 270 - pprint.PrettyPrinter().pprint(msg) 267 + pprint.pprint(msg, width=term_width(), compact=True) 271 268 272 269 if args.list_families: 273 270 for filename in sorted(os.listdir(spec_dir())):