thefuck icon indicating copy to clipboard operation
thefuck copied to clipboard

Npx: Create npx_add_npx_to_command.py

Open KartikSoneji opened this issue 4 years ago • 2 comments

Add npx to command

Prefixes npx to command name to run locally installed npm commands, also corrects misspelled npx commands.

Example
jest npx jest
npx jeet npx jest
jeet npx jest

KartikSoneji avatar Jul 19 '20 22:07 KartikSoneji

I am not sure how to write tests for the code, any help would be appreciated.

KartikSoneji avatar Jul 20 '20 00:07 KartikSoneji

Thanks for contributing, @KartikSoneji! Apologies for the delay.

This is looking good. Regarding tests, you can base off of any existing test and write unit tests for match and get_new_command. Take the following as an example:

https://github.com/nvbn/thefuck/blob/11b70526f72339bcce0beefa1665c74bb06e18b3/tests/rules/test_git_commit_add.py#L1-L38

scorphus avatar Jul 16 '21 12:07 scorphus