default progress display to true if on a tty

this makes --progress a toggle: if there's a terminal, it turns it
off, if there isn't, it forces it on.
This commit is contained in:
Antoine Beaupré 2015-10-16 11:30:41 -04:00
parent e4f325182e
commit 92ac120fb0
1 changed files with 4 additions and 4 deletions

View File

@ -677,11 +677,11 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
subparser.add_argument('-s', '--stats', dest='stats', subparser.add_argument('-s', '--stats', dest='stats',
action='store_true', default=False, action='store_true', default=False,
help='print statistics for the created archive') help='print statistics for the created archive')
subparser.add_argument('-p', '--progress', dest='progress', subparser.add_argument('-p', '--progress', dest='progress', const=not sys.stdin.isatty(),
action='store_true', default=False, action='store_const', default=sys.stdin.isatty(),
help="""print progress while creating the archive, showing Original, help="""toggle progress display while creating the archive, showing Original,
Compressed and Deduplicated sizes, followed by the Number of files seen Compressed and Deduplicated sizes, followed by the Number of files seen
and the path being processd""") and the path being processd, default: %(default)s""")
subparser.add_argument('-e', '--exclude', dest='excludes', subparser.add_argument('-e', '--exclude', dest='excludes',
type=ExcludePattern, action='append', type=ExcludePattern, action='append',
metavar="PATTERN", help='exclude paths matching PATTERN') metavar="PATTERN", help='exclude paths matching PATTERN')