def get_new_command(command): misspelled_script = re.findall( r'.*missing script: (.*)\n', command.output)[0] return replace_command(command, misspelled_script, get_scripts())
def match(command): return ('Usage: npm <command>' in command.output and not any(part.startswith('ru') for part in command.script_parts) and command.script_parts[1] in get_scripts())
def test_get_scripts(mocker): patch = mocker.patch('thefuck.specific.npm.Popen') patch.return_value.stdout = BytesIO(run_script_stdout) assert get_scripts() == ['build', 'develop', 'watch-test']
def test_get_scripts(mocker): patch = mocker.patch("thefuck.specific.npm.Popen") patch.return_value.stdout = BytesIO(run_script_stdout) assert get_scripts() == ["build", "develop", "watch-test"]
def match(command): return ('Usage: npm <command>' in command.stdout and not any(part.startswith('ru') for part in command.script_parts) and command.script_parts[1] in get_scripts())