fix grep regression

This commit is contained in:
Manuel Barkhau 2020-10-04 21:37:03 +00:00
parent b5df665251
commit 43fe8df1fd
3 changed files with 30 additions and 29 deletions

View file

@ -285,21 +285,23 @@ def grep(
)
sys.exit(1)
else:
if is_version_pattern_required:
normalize_pattern = v2patterns.normalize_pattern(version_pattern, raw_pattern)
else:
normalize_pattern = raw_pattern
version_pattern = "vYYYY0M.BUILD[-RELEASE]"
if is_version_pattern_required:
normalized_pattern = v2patterns.normalize_pattern(version_pattern, raw_pattern)
else:
normalized_pattern = raw_pattern
isatty = getattr(sys.stdout, 'isatty', lambda: False)
if isatty():
colorama.init()
try:
_grep(normalize_pattern, files, color=True)
_grep(normalized_pattern, files, color=True)
finally:
colorama.deinit()
else:
_grep(normalize_pattern, files, color=False)
_grep(normalized_pattern, files, color=False)
@cli.command()