From f0adfa08430ef320c07f8af01baef9290fa3c391 Mon Sep 17 00:00:00 2001 From: sedrubal Date: Sat, 20 Oct 2018 16:55:31 +0200 Subject: [PATCH] Add default format auto --- yamllint/cli.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yamllint/cli.py b/yamllint/cli.py index 0d2055d..5cb84fc 100644 --- a/yamllint/cli.py +++ b/yamllint/cli.py @@ -96,8 +96,8 @@ def run(argv=None): action='store', help='custom configuration (as YAML source)') parser.add_argument('-f', '--format', - choices=('parsable', 'standard', 'colored'), - default='standard', help='format for parsing output') + choices=('parsable', 'standard', 'colored', 'auto'), + default='auto', help='format for parsing output') parser.add_argument('-s', '--strict', action='store_true', help='return non-zero exit code on warnings ' @@ -143,7 +143,8 @@ def run(argv=None): for problem in linter.run(f, conf, filepath): if args.format == 'parsable': print(Format.parsable(problem, file)) - elif supports_color() or args.format == 'colored': + elif args.format == 'colored' or \ + (args.format == 'auto' and supports_color()): if first: print('\033[4m%s\033[0m' % file) first = False