diff mbox series

patman: Handle PAGER containing arguments

Message ID 20210615102522.16545-1-paul.barker@sancloud.com
State Changes Requested
Delegated to: Simon Glass
Headers show
Series patman: Handle PAGER containing arguments | expand

Commit Message

Paul Barker June 15, 2021, 10:25 a.m. UTC
When printing full help output from patman, we should be able to handle
a PAGER variable which includes arguments, e.g. PAGER='less -F'.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
---

 tools/patman/main.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Simon Glass June 26, 2021, 6:31 p.m. UTC | #1
Hi Paul,

On Tue, 15 Jun 2021 at 04:26, Paul Barker <paul.barker@sancloud.com> wrote:
>
> When printing full help output from patman, we should be able to handle
> a PAGER variable which includes arguments, e.g. PAGER='less -F'.
>
> Signed-off-by: Paul Barker <paul.barker@sancloud.com>
> ---
>
>  tools/patman/main.py | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>

Can you please add a function to print full help to test_util.py
instead? Then we can use it in the other tools too.

Regards,
Simon
Paul Barker June 29, 2021, 1:09 p.m. UTC | #2
On Sat, 26 Jun 2021 12:31:41 -0600
Simon Glass <sjg@chromium.org> wrote:

> Hi Paul,
> 
> On Tue, 15 Jun 2021 at 04:26, Paul Barker <paul.barker@sancloud.com>
> wrote:
> >
> > When printing full help output from patman, we should be able to
> > handle a PAGER variable which includes arguments, e.g. PAGER='less
> > -F'.
> >
> > Signed-off-by: Paul Barker <paul.barker@sancloud.com>
> > ---
> >
> >  tools/patman/main.py | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >  
> 
> Can you please add a function to print full help to test_util.py
> instead? Then we can use it in the other tools too.

Thanks for the feedback, I'll take a look at this next week and send an
updated patch.
Paul Barker July 20, 2021, 8:51 a.m. UTC | #3
On Sat, 26 Jun 2021 12:31:41 -0600
Simon Glass <sjg@chromium.org> wrote:

> Hi Paul,
> 
> On Tue, 15 Jun 2021 at 04:26, Paul Barker <paul.barker@sancloud.com> wrote:
> >
> > When printing full help output from patman, we should be able to handle
> > a PAGER variable which includes arguments, e.g. PAGER='less -F'.
> >
> > Signed-off-by: Paul Barker <paul.barker@sancloud.com>
> > ---
> >
> >  tools/patman/main.py | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >  
> 
> Can you please add a function to print full help to test_util.py
> instead? Then we can use it in the other tools too.
> 
> Regards,
> Simon

Hi Simon,

I had to delay work on this due to illness, it's still on my list
though.

Thanks,
diff mbox series

Patch

diff --git a/tools/patman/main.py b/tools/patman/main.py
index 04e37a5931..4d6f195b7c 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -9,6 +9,7 @@ 
 from argparse import ArgumentParser
 import os
 import re
+import shlex
 import shutil
 import sys
 import traceback
@@ -170,14 +171,14 @@  elif args.cmd == 'send':
         fd.close()
 
     elif args.full_help:
-        pager = os.getenv('PAGER')
+        pager = shlex.split(os.getenv('PAGER'))
         if not pager:
-            pager = shutil.which('less')
+            pager = [shutil.which('less')]
         if not pager:
-            pager = 'more'
+            pager = ['more']
         fname = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
                              'README')
-        command.Run(pager, fname)
+        command.Run(*pager, fname)
 
     else:
         # If we are not processing tags, no need to warning about bad ones