Subject: Re: [PATCH net-next 2/7] tools: ynl: cli: wrap the doc text if it's long

From: Jakub Kicinski <[email-masked]>
Date: Sat, 10 Jan 2026 11:07:57 -0800

On Sat, 10 Jan 2026 11:04:08 -0800 Stanislav Fomichev wrote:
> > @@ -101,7 +102,14 @@ RELATIVE_SCHEMA_DIR='../../../../Documentation/netlink'
> >                  attr_info += f" -> {nested_set_name}"
> >  
> >              if attr.yaml.get('doc'):
> > -                doc_text = textwrap.indent(attr.yaml['doc'], prefix + '  ')
> > +                doc_prefix = prefix + ' ' * 4
> > +                if sys.stdout.isatty():
> > +                    term_width = shutil.get_terminal_size().columns
> > +                else:
> > +                    term_width = 80
> > +                doc_text = textwrap.fill(attr.yaml['doc'], width=term_width,
> > +                                         initial_indent=doc_prefix,
> > +                                         subsequent_indent=doc_prefix)  
> 
> Any specific reason you wrap to 80 for !isatty?

not really, just the default width of a classic terminal
the textwrap library defaults to 70 which is another option tho
I doubt there's a strong reason behind that value either..