Skip to content

Commit 0a0f605

Browse files
committed
Make output more easily machine readable
1 parent ccd245a commit 0a0f605

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎language_tool/main.py‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,15 @@ def main():
116116
elif args.apply:
117117
print(lang_tool.correct(text))
118118
else:
119-
print()
120-
for n, match in enumerate(lang_tool.check(text)):
121-
print('{}.) {}'.format(n + 1, match))
122-
print()
119+
for match in lang_tool.check(text):
120+
replacement_text = ', '.join(match.replacements).strip()
121+
print('{}:{}:{}: {}{}'.format(
122+
filename,
123+
match.fromy + 1,
124+
match.fromx + 1,
125+
match.msg,
126+
('; suggestions: ' + replacement_text)
127+
if replacement_text else ''))
123128
status = 2
124129

125130
return status

‎test.bash‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ echo 'This is okay.' | language-tool -
66
! echo 'This is noot okay.' | language-tool -
77

88
echo 'This is okay.' | python -m language_tool -
9+
! echo 'This is noot okay.' | python -m language_tool -

0 commit comments

Comments
 (0)