Using the `force_command` argument will run into issues as the
`_get_raw_command` method simply returns the value of `force_command`
(which is a string) while it should actually return a list.
Fix#1240
* adding devcontainer and new rule for main-master
* update devcontainer work
* cleaning up devcontainer.json
* fixed line ending
* move to VARIANT 3
* Update .devcontainer/devcontainer.json
* Update .devcontainer/devcontainer.json
* Update .devcontainer/devcontainer.json
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
* Resolve paths before checking app identity
Commands entered with a path do not match is_app. I encountered this
when working with a test for the rm_dir rule. This rule did not use the
@for_app decorator, but when I migrated it, the test for "./bin/hdfs.."
failed because 'hdfs' was recognized as a command, while "./bin/hdfs"
was not.
This commit addresses the false negative by resolving path names in the
command, via os.path.basename.
* Remove paths from for_app invocations in rules
I presume that the `./` in `./gradlew` was used here because thefuck
would not find an app match on just `gradlew`, and thus no fucks would
be given on the most common and idiomatic way of invoking gradlew.
After 8faf9b1, thefuck does not distinguish between commands with
paths and those without. Therefore, the tests for this rule are now
broken because thefuck strips paths from the _user_'s command, but not
from the for_app decoration.
This commit addresses that problem by changing the for_app decoration to
this rule.
* fix fuckup `branch 0v` by...
...deleting branch `0v` and running `git branch -v` as the user intended
* use quotes consistently
* provide new solution implementation based on feedback on PR
* rename files to more accurately reflect their more generic contents
* update import statement to match new file name
* update command name in README.md
* separate out matching tests so the pattern is clear for those who add matches in the future
* ~[Doc] Add Uninstall instructions
As we need the package and to modify the shell config, users could have a pain in the ass when it comes to retire *The Fuck* from the system.
* Update README.md
* Update README.md
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
pkg_resources is expensive to load, and it's an external module provided
by the setuptools project.
Let's use importlib.metadata from Python 3.8+'s stdlib when available, which
is much faster. This also erases setuptools from thefuck's runtime
dependency.
Simple benchmark data for `thefuck --version`:
Before: 0.602s
After: 0.169s
Improves performance in WSL
Fix#1036
* Add excluded_search_path_prefixes setting
Allows filtering the paths used to search for commands
Can be useful to filter out /mnt/ in WSL for performance
* Add test for excluded_search_path_prefixes
* Apply suggestions from code review
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
For some reason, the index used by GH Actions is not considering the
requesting Python version to decide which package version to deliver.
This is unnecessary for the official index and will be removed once we
drop support to Python 2.
* adding in files for the cd-cs feature
* Updated thefuck/rules/cd_cs.py comments to be more verbose
Thanks Scorphus!
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
* Updating the rules file to exclude the \xe2 character
This character(–) has lead to the commit failing some of the tests.
I am removing it from the code and we should see the tests pass now.
* Setting the encoding in thefuck/rules/cd_cs.py
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
Co-authored-by: SID SHARDANAND <sshardan@deakin.edu.au>
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>