8833528 Implement automatic pager for generate-changelog subcommand

3 files Authored by zbyszek a year ago, Committed by nphilipp a year ago,
    Implement automatic pager for generate-changelog subcommand
    
    This makes 'rpmautospec generate-changelog' behave like 'git log' and other
    commands that start a pager whenever lengthy output is expected. Since we
    generally want to look at the top lines in the changelog, this makes it much
    nicer to work with this command.
    
    The pager is enabled by default (when on tty, etc.), but can be disabled with
    --no-pager.
    
    I first wrote an implementation that starts "less" or a fallback using
    subprocess.Popen(), but that seems overkill. The only command that produces
    enough text for paging to be useful is 'generate-changelog', and there we get
    the full string to print, so we can trivially reuse the pydoc pager which starts
    less for us. The only tweak that is made is that $LESS is set in the environment
    so that the output looks nice. $RPMAUTOSPEC_LESS can be used to override the
    options if desired.
    
    Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
    
        
file modified
+12 -1
file added
+17