public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tools: ynl: cli: make the output compact
@ 2026-01-31 20:30 Jakub Kicinski
  2026-02-01 17:06 ` Donald Hunter
  2026-02-03  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-01-31 20:30 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	donald.hunter, sdf, gal

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,

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: donald.hunter@gmail.com
CC: sdf@fomichev.me
CC: gal@nvidia.com
---
 tools/net/ynl/pyynl/cli.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/net/ynl/pyynl/cli.py b/tools/net/ynl/pyynl/cli.py
index fdac1ab10a40..94a5ba348b69 100755
--- a/tools/net/ynl/pyynl/cli.py
+++ b/tools/net/ynl/pyynl/cli.py
@@ -44,6 +44,10 @@ RELATIVE_SCHEMA_DIR='../../../../Documentation/netlink'
         return f"{modifiers}{text}{Colors.RESET}"
     return text
 
+def term_width():
+    """ Get terminal width in columns (80 if stdout is not a terminal) """
+    return shutil.get_terminal_size().columns
+
 def schema_dir():
     """
     Return the effective schema directory, preferring in-tree before
@@ -103,8 +107,7 @@ RELATIVE_SCHEMA_DIR='../../../../Documentation/netlink'
 
             if attr.yaml.get('doc'):
                 doc_prefix = prefix + ' ' * 4
-                term_width = shutil.get_terminal_size().columns
-                doc_text = textwrap.fill(attr.yaml['doc'], width=term_width,
+                doc_text = textwrap.fill(attr.yaml['doc'], width=term_width(),
                                          initial_indent=doc_prefix,
                                          subsequent_indent=doc_prefix)
                 attr_info += f"\n{doc_text}"
@@ -264,7 +267,7 @@ RELATIVE_SCHEMA_DIR='../../../../Documentation/netlink'
         if args.output_json:
             print(json.dumps(msg, cls=YnlEncoder))
         else:
-            pprint.PrettyPrinter().pprint(msg)
+            pprint.pprint(msg, width=term_width(), compact=True)
 
     if args.list_families:
         for filename in sorted(os.listdir(spec_dir())):
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tools: ynl: cli: make the output compact
  2026-01-31 20:30 [PATCH net-next] tools: ynl: cli: make the output compact Jakub Kicinski
@ 2026-02-01 17:06 ` Donald Hunter
  2026-02-03  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Donald Hunter @ 2026-02-01 17:06 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, sdf, gal

Jakub Kicinski <kuba@kernel.org> writes:

> 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,
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tools: ynl: cli: make the output compact
  2026-01-31 20:30 [PATCH net-next] tools: ynl: cli: make the output compact Jakub Kicinski
  2026-02-01 17:06 ` Donald Hunter
@ 2026-02-03  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-03  1:10 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	donald.hunter, sdf, gal

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 31 Jan 2026 12:30:29 -0800 you wrote:
> 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,
> 	    ...
> 
> [...]

Here is the summary with links:
  - [net-next] tools: ynl: cli: make the output compact
    https://git.kernel.org/netdev/net-next/c/71a58ec6672f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-03  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31 20:30 [PATCH net-next] tools: ynl: cli: make the output compact Jakub Kicinski
2026-02-01 17:06 ` Donald Hunter
2026-02-03  1:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox