Exit 0 if nothing has been modified, else non-zero.

This commit is contained in:
Jules Lasne (jlasne) 2019-03-14 18:22:02 +01:00 committed by Julien Palard
parent 0391e0e0b3
commit 0b6a141366

View File

@ -12,6 +12,7 @@ from tqdm import tqdm
def fix_style(po_files, modified=False, no_wrap=False):
"""Fix style of unversionned ``.po`` files, or or all f
"""
return_status = 0
if modified:
git_status = check_output(["git", "status", "--porcelain"], encoding="utf-8")
git_status_lines = [
@ -29,6 +30,8 @@ def fix_style(po_files, modified=False, no_wrap=False):
if no_wrap:
args[1:1] = ["--no-wrap"]
run(args, encoding="utf-8", check=True, input=po_content)
return_status = 1
return return_status
def main():
@ -51,4 +54,4 @@ def main():
if not args.po_files and not args.modified:
parser.print_help()
exit(1)
fix_style(args.po_files, args.modified, args.no_wrap)
exit(fix_style(args.po_files, args.modified, args.no_wrap))