1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-20 09:39:01 +00:00

Fix double npx prefix.

This commit is contained in:
Kartik Soneji 2020-07-20 05:44:09 +06:00
parent a6341fe20b
commit 910c1ead32

View File

@ -11,13 +11,17 @@ enabled_by_default = bool(which('npx'))
def match(command): def match(command):
return \ return \
'not found' in command.output.lower() and \ 'not found' in command.output.lower() and \
bool(get_matching_npm_executables_in_cd()) bool(get_matching_npm_executables_in_cd(command))
def get_new_command(command): def get_new_command(command):
skip = 1
if command.script_parts[0] == 'npx':
skip += 1
script_parts = command.script_parts[skip:]
return [ return [
' '.join(['npx', e, *command.script_parts[1:]]) ' '.join(['npx', e, *script_parts])
for e in get_matching_npm_executables_in_cd() for e in get_matching_npm_executables_in_cd(command)
] ]