diff --git a/tests/test_utils.py b/tests/test_utils.py index 8a315916..eae743f5 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -146,6 +146,8 @@ def test_get_all_matched_commands(stderr, result): @pytest.mark.usefixtures('no_memoize') @pytest.mark.parametrize('script, names, result', [ + ('/usr/bin/git diff', ['git', 'hub'], True), + ('/bin/hdfs dfs -rm foo', ['hdfs'], True), ('git diff', ['git', 'hub'], True), ('hub diff', ['git', 'hub'], True), ('hg diff', ['git', 'hub'], False)]) @@ -155,6 +157,8 @@ def test_is_app(script, names, result): @pytest.mark.usefixtures('no_memoize') @pytest.mark.parametrize('script, names, result', [ + ('/usr/bin/git diff', ['git', 'hub'], True), + ('/bin/hdfs dfs -rm foo', ['hdfs'], True), ('git diff', ['git', 'hub'], True), ('hub diff', ['git', 'hub'], True), ('hg diff', ['git', 'hub'], False)]) diff --git a/thefuck/rules/gradle_no_task.py b/thefuck/rules/gradle_no_task.py index 7820d1df..4a074794 100644 --- a/thefuck/rules/gradle_no_task.py +++ b/thefuck/rules/gradle_no_task.py @@ -5,7 +5,7 @@ from thefuck.utils import for_app, eager, replace_command regex = re.compile(r"Task '(.*)' (is ambiguous|not found)") -@for_app('gradle', './gradlew') +@for_app('gradle', 'gradlew') def match(command): return regex.findall(command.output) diff --git a/thefuck/utils.py b/thefuck/utils.py index 3a632a5a..42f32631 100644 --- a/thefuck/utils.py +++ b/thefuck/utils.py @@ -180,7 +180,7 @@ def is_app(command, *app_names, **kwargs): raise TypeError("got an unexpected keyword argument '{}'".format(kwargs.keys())) if len(command.script_parts) > at_least: - return command.script_parts[0] in app_names + return os.path.basename(command.script_parts[0]) in app_names return False