1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-16 07:38:50 +00:00
thefuck/thefuck/rules/cat_dir.py
Scott Colby 23b27c16dc First attempt at adding internationalization to the cat error message detection.
Fix the tests for inside virtualenvs and add warning if localization appears impossible.

Remove the language warnings for en_US locales and make sure they appear for others.
2018-07-10 14:03:58 -07:00

15 lines
370 B
Python

import gettext
def match(command):
eisdir = gettext.translation('libc', fallback=True).gettext('Is a directory')
return (
command.script.startswith('cat') and
command.output.startswith('cat: ') and
command.output.rstrip().endswith(': %s' % eisdir)
)
def get_new_command(command):
return command.script.replace('cat', 'ls', 1)