1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-11-01 15:42:06 +00:00

Compare commits

..

1349 Commits
1.19 ... 3.26

Author SHA1 Message Date
Vladimir Iakovlev
d5cc7ec43b Bump to 3.26 2018-04-25 18:19:14 +02:00
Adam B
33a87502cd Update README.md for clarity and concision (#794)
Reworded several sentences and paragraphs for clarity and concision. All original information was maintained.
2018-04-01 16:25:09 -04:00
Vladimir Iakovlev
82a12dda81 #N/A: Test only with python3 in ci on osx
Default python version in homebrew is changed to 3.6, more details - https://brew.sh/2018/01/19/homebrew-1.5.0/
2018-03-19 23:26:35 +01:00
Vladimir Iakovlev
4c9099a79b #N/A: Fix mmap log cleanup 2018-03-19 22:41:38 +01:00
Vladimir Iakovlev
1508ecfeae #N/A: Use mmap for sharing output in instant mode 2018-03-14 00:12:40 +01:00
Vladimir Iakovlev
284d49da8d #786: Fix tests 2018-02-23 21:15:05 +01:00
Vladimir Iakovlev
fb39d0bbd3 #786: Fix apt_get rule on ubuntu 18.04 2018-02-23 21:08:41 +01:00
Vladimir Iakovlev
ed24e4ca61 Squashed commit of the following:
commit 8573f94c2f3ba17ec5d7dd123338c14a550e57e6
Author: Vladimir Iakovlev <nvbn.rm@gmail.com>
Date:   Fri Feb 23 20:45:01 2018 +0100

    #785: Remove functional test

commit 5484576d6e3ef4a53d69860ef953bb48037e8a72
Merge: a36a8b4 f59aa93
Author: Vladimir Iakovlev <nvbn.rm@gmail.com>
Date:   Fri Feb 23 20:44:20 2018 +0100

    Merge branch 'master' of https://github.com/alexbarcelo/thefuck into alexbarcelo-master

commit f59aa931c3
Author: Alex Barcelo <alex.barcelo@gmail.com>
Date:   Fri Feb 16 23:43:43 2018 +0100

    rewritten match + fish output check for cd_* rules

commit 150ecee00f
Author: Alex Barcelo <alex.barcelo@gmail.com>
Date:   Fri Feb 16 23:43:19 2018 +0100

    Adding unittest for cd_correction (with extra fish test case, also for cd_mkdir)

commit e73dd3f6d1
Author: Alex Barcelo <alex.barcelo@gmail.com>
Date:   Fri Feb 16 22:48:22 2018 +0100

    adding functional test for cd_correction rule

commit d1dbbb57d9
Author: Alex Barcelo <alex@betarho.net>
Date:   Fri Feb 16 12:21:33 2018 +0100

    Include root (start with /) case
2018-02-23 20:45:36 +01:00
Vladimir Iakovlev
a36a8b4de1 Merge branch 'master' of github.com:nvbn/thefuck 2018-02-23 20:44:08 +01:00
Vladimir Iakovlev
2678adf981 #788: Use uniq last tracker path for different users 2018-02-23 20:42:00 +01:00
JunYoung Gwak
dd9554539f Added a rule to delete sudo for pacaur. (#787) 2018-02-22 22:14:02 +01:00
Omer Katz
b65e3a9aad Added hebrew the list of keyboard layouts (#778)
* Added hebrew the list of keyboard layouts.

Fixes #776.

* Added tests for hebrew layout.

* Fix test.

* Make lint happy.
2018-01-29 08:46:18 +01:00
Joseph Frazier
027b41da59 Add git_merge_unrelated rule for git merge --allow-unrelated-histories (#773)
From https://git-scm.com/docs/merge-options#merge-options---allow-unrelated-histories

> By default, `git merge` command refuses to merge histories that do not
share a common ancestor. This option can be used to override this safety
when merging histories of two projects that started their lives
independently.
2018-01-16 20:03:56 -05:00
Guangyuan (Charlie) Yang
aa45585601 Add installation instructions on FreeBSD (#770)
misc/thefuck has recently been committed to the FreeBSD ports tree (https://svnweb.freebsd.org/ports?view=revision&revision=458123).
2018-01-10 21:31:38 +01:00
David Hart
c205683a8d git_push: Handle branch names containing 'set-upstream' (#759)
This should fix https://github.com/nvbn/thefuck/issues/723 (IndexError when using bitbucket)
2018-01-06 17:44:03 -05:00
David Hart
7c858fadb3 #762: handle single quotes in git_branch_exists
* handle single quotes in git_branch_exists

* Fix line length

* Fix missing quotes from test
2018-01-05 19:25:08 -02:00
David Hart
797ca1c564 Offer git commit --amend after previous git commit (#764) 2018-01-05 16:24:43 -05:00
David Hart
7b10a86267 Add rule for ADB unknown commands (#765) 2018-01-05 16:20:03 -05:00
David Hart
b62bb90a0d git_push: Escape single quote in branch names (#760)
Parameterize test output fixture.

Check for 'push' in command.script_parts than anywhere in command.script.
2018-01-04 11:40:01 -05:00
Joseph Frazier
a696461cd3 Add apt_upgrade rule (#761)
* apt_list_upgradable: Prepend sudo to suggestion if used in command

* Add apt_upgrade rule

This suggests `apt upgrade` after `apt list --upgradable` if there are
packages to upgrade. It pairs well with the `apt_list_upgradable` rule,
which suggests `apt list --upgradable` after `apt update` if there are
packages to upgrade.

* Add apt_upgrade rule to README
2018-01-03 19:01:09 +01:00
Joseph Frazier
7e6d1dbc7c Move Developing instructions from README to CONTRIBUTING (#757)
* Move Developing instructions from README to CONTRIBUTING

This makes them easier to find, especially for users opening issues or
pull requests. See here for more details:
https://help.github.com/articles/setting-guidelines-for-repository-contributors/

* fixup! Move Developing instructions from README to CONTRIBUTING
2018-01-03 19:00:20 +01:00
Joseph Frazier
4fb85b0a92 Add GitHub Issue template (#749)
This prompts the user to include relevant information when reporting
issues. I adapted it from the corresponding section of CONTRIBUTING.md

See here for details: https://github.com/blog/2111-issue-and-pull-request-templates
2018-01-03 18:59:38 +01:00
David Hart
83e1710712 Fix fish shell aliasing (#753)
* Handle user defined fish aliases

* Add more aliases to test

* Revert unecessary Popen mock changes

* Add test for fish aliasing

Fixes #727
2018-01-02 23:14:02 -05:00
Pablo Santiago Blum de Aguiar
045c8ae76c #738: Assert TF_SHELL is defined in bash and zsh aliases 2018-01-02 17:18:34 -02:00
Pablo Santiago Blum de Aguiar
bcb749722b #738: Set SHELL env var for fish and tcsh 2018-01-02 17:18:34 -02:00
David Hart
f700b23f57 Add git merge rule (#755)
This fixes https://github.com/nvbn/thefuck/issues/629
2018-01-02 11:47:48 -05:00
Joseph Frazier
897572d278 README: Use pip3 in upgrade command (#756)
Fixes https://github.com/nvbn/thefuck/issues/615
2018-01-02 10:14:11 -05:00
Joseph Frazier
0640509895 Drop Python 3.3 Support (#747)
* Drop Python 3.3 Support

It's reached end-of-life, and our dependencies have started to drop it.
See https://github.com/nvbn/thefuck/pull/744#issuecomment-353244371

* Revert "Use pytest<3.3 to fix Python 3.3 tests (#746)"

This reverts commit f966ecd4f5.
2018-01-01 20:18:05 -05:00
David Hart
57fb6e079a git_push: Make option handling more robust (#751)
See https://github.com/nvbn/thefuck/issues/740#issuecomment-354466567
2018-01-01 19:45:46 -05:00
David Hart
83cf97dc26 Suggest git checkout -b (#754)
This fixes https://github.com/nvbn/thefuck/issues/632

This uses `script_parts` instead of `script.startswith`
to let it work even if there's extra spaces in the command, e.g.

    git  checkout unknown
2018-01-01 18:30:33 -05:00
Miguel Piedrafita
9e788196e6 Update license year to 2015-2018 (#752) 2018-01-01 12:53:34 -05:00
Joseph Frazier
4ea02a3153 git_push: Don't add duplicate remote/branch name (#745)
This fixes https://github.com/nvbn/thefuck/issues/740
2017-12-27 07:54:52 -05:00
Joseph Frazier
f966ecd4f5 Use pytest<3.3 to fix Python 3.3 tests (#746)
See https://github.com/nvbn/thefuck/pull/744 for context.

I'm personally okay with dropping Python 3.3 support,
but I'd like to at least get the tests working while we decide on that.
2017-12-20 20:43:01 -05:00
Vladimir Iakovlev
629056077f #783: Don't rely on $SHELL for detecting shell 2017-11-27 21:08:46 +01:00
Vladimir Iakovlev
4780027d63 Bump to 3.25 2017-11-23 20:51:04 +01:00
Vladimir Iakovlev
4847078f37 #737: Add support of third-party rules 2017-11-23 20:21:44 +01:00
Joseph Frazier
d582159670 Add apt_list_upgradable rule (#732)
This helps you run `apt list --upgradable` after `apt update`,
as it suggests.
2017-11-16 20:19:44 +01:00
Jarrod Moore
97123dbf73 Fix zsh alias (#733) 2017-11-16 20:19:16 +01:00
Joseph Frazier
10ac1a3b38 #728: Add heroku_multiple_apps rule (#729)
Closes https://github.com/nvbn/thefuck/issues/728
2017-11-09 18:42:23 -05:00
Joseph Frazier
8fb5ddefb6 git_flag_after_filename: Handle new error message
See 2a5aa826ee
2017-11-01 09:42:52 -04:00
Joseph Frazier
f1fab0dbb2 git_flag_after_filename: Call match() instead of copying its body 2017-11-01 09:42:52 -04:00
Vladimir Iakovlev
68df7154e5 #N/A: FIx new flake8 warnings 2017-10-25 19:31:03 +02:00
Vladimir Iakovlev
08082e606b #715: Fix work on Windows 2017-10-25 19:16:28 +02:00
Vladimir Iakovlev
b2789ad899 Bump to 3.24 2017-10-16 20:11:01 +02:00
Vladimir Iakovlev
72f0df2f90 #711: Handle ctrl+n and ctrl+p 2017-10-16 19:19:29 +02:00
Vladimir Iakovlev
50d14be43a Merge branch 'scorphus-pull-request-702' 2017-10-16 19:09:53 +02:00
Vladimir Iakovlev
054fd0b166 #702: Make match in php_s rule more strict 2017-10-16 19:09:44 +02:00
Pablo Santiago Blum de Aguiar
75d2c43997 #702: fix minor issues with php_s rule
Unfortunately, I didn't catch these issues while reviewing #702.

After looking more closely at `php` options, `-S` requires additional
arguments (<address>:<port>) and `-s` may produce output if used that
way. So, matching ` -s ` seems to be better.

Also, `@for_app('php')` already asserts the presence of `php ` in the
command script. Matching `php -s` prevents the rule from fixing commands
like `php -t public -s 0.0.0.0:8080`.
2017-10-15 17:18:21 -02:00
Stef Pletinck
64d6835e15 #652: Add new git_push_different_branch_names rule
Fix #652

* Basic fix for #652
* Finishing work
* Added readme line
* Added test
* My test was stupid...
* Removed redundant lines
* That space...
2017-10-15 13:30:29 -02:00
Vladimir Iakovlev
2233e3679c Merge branch 'matthewfallshaw-patch-1' 2017-10-15 16:39:49 +02:00
Vladimir Iakovlev
bab5de236f #710: Fix tests 2017-10-15 16:39:40 +02:00
Vladimir Iakovlev
8a4f37edb3 Merge branch 'patch-1' of https://github.com/matthewfallshaw/thefuck into matthewfallshaw-patch-1 2017-10-15 16:32:57 +02:00
Vladimir Iakovlev
a566e040f7 #N/A: Fix deprecation warnings 2017-10-15 16:16:43 +02:00
Vladimir Iakovlev
10a4e910e9 #N/A: Fix deprecation warnings 2017-10-15 16:13:36 +02:00
Vladimir Iakovlev
985b2d9ec9 #N/A: Add brew_cask_dependency rule 2017-10-15 16:11:08 +02:00
Vladimir Iakovlev
a906a751c8 #N/A: Add prove_recursively rule 2017-10-15 15:51:09 +02:00
Matthew Fallshaw
d11ca52ec9 Bugfix: brew_update_formula.py
Sample command output is:

    Error: This command updates brew itself, and does not take formula names.
    Use 'brew upgrade thefuck' instead.

This will never match the previous `"Use 'brew upgrade <formula>'" in command.output` test.
2017-10-12 13:43:28 -07:00
Stef Pletinck
e658f35bd9 quick fix for #655 (#702)
* quick fix for #655

* Enabled by default and fix

* Test

* Added readme line

* This is unnecessary
2017-10-10 19:24:38 +02:00
Vladimir Iakovlev
21a916d953 #708: Fix handling of shelve errors 2017-10-10 19:19:54 +02:00
Vladimir Iakovlev
d228091beb #707: Don't use @cache on methods 2017-10-10 19:15:36 +02:00
Vladimir Iakovlev
5d14d65837 #707: Use pickle for cache keys 2017-10-10 19:14:42 +02:00
Vladimir Iakovlev
1f8f3dd967 #707: Update tests 2017-10-10 08:31:45 +02:00
Vladimir Iakovlev
d9fd5e8a6b #707: Reimplement cache 2017-10-10 08:30:26 +02:00
Vladimir Iakovlev
7a04a1f4c5 Merge branch 'master' of github.com:nvbn/thefuck 2017-10-09 19:06:53 +02:00
Vladimir Iakovlev
c2de69bbfd #682: Fix zsh PS1 width in experimental instant mode 2017-10-09 19:03:18 +02:00
Vladimir Iakovlev
b1730ed8e1 Merge pull request #706 from scorphus/pull-request-701
Fix minor issues with git_remote_delete
2017-10-09 18:47:13 +02:00
Pablo Santiago Blum de Aguiar
af1a88b271 #701: Do not require git in the script
@git_support already does that
2017-10-08 21:15:28 -03:00
Pablo Santiago Blum de Aguiar
dfd0be2002 #701: Replace the first single occurrence of delete 2017-10-08 18:55:44 -03:00
Vladimir Iakovlev
3253b0e789 #682: Fix functional tests for experimental instant mode 2017-10-08 17:16:15 +02:00
Vladimir Iakovlev
1ab0e80f8f #682: Fix PS1 on macos with zsh 2017-10-08 16:39:13 +02:00
Vladimir Iakovlev
78a9d52df0 #N/A: Remove enabled_by_default = True from rules 2017-10-08 16:27:23 +02:00
Vladimir Iakovlev
6362c37eec Merge pull request #701 from Epse/#670-git_remote_delete
fixed #670
2017-10-08 16:25:59 +02:00
Vladimir Iakovlev
f333dfe657 Merge pull request #698 from Epse/dnf-module
Basic DNF support
2017-10-08 16:19:51 +02:00
Vladimir Iakovlev
ad294bc4d4 Merge pull request #704 from z3ntu/issue/658
#658: Change configuration code for fish shell
2017-10-08 16:18:58 +02:00
Vladimir Iakovlev
d2c70bd8b8 #682: Use our own shell logger, fix experimental instant mode on macos 2017-10-08 16:17:41 +02:00
Stef Pletinck
f24110de56 added readme line 2017-10-07 14:01:26 +02:00
Stef Pletinck
b6ecaf4d86 Enabled by default 2017-10-07 13:59:51 +02:00
Stef Pletinck
f372f3d56c Added test 2017-10-07 13:59:32 +02:00
Stef Pletinck
be48f02784 Tests! Also fixed some bytes-string issues 2017-10-07 12:59:21 +02:00
Stef Pletinck
449cb9a006 Added README line 2017-10-06 17:13:29 +02:00
Vladimir Iakovlev
edac010a7b Merge pull request #705 from scorphus/fix-appveyor-build
#N/A: Use curl to download get-pip.py on AppVeyor
2017-10-06 07:55:55 +02:00
Pablo Santiago Blum de Aguiar
c2c98d5f69 #N/A: Use curl to download get-pip.py on AppVeyor
`curl` seems to be smarter than `net.webclient` when dealing with SSL.
2017-10-06 01:16:15 -03:00
Luca Weiss
4f3ab71934 #658: Change configuration code for fish shell 2017-10-05 20:57:08 +02:00
Stef Pletinck
89bc2e9759 fixed #670 2017-10-05 18:44:04 +02:00
Stef Pletinck
f465fb3ed8 Slightly more comments 2017-10-05 16:50:44 +02:00
Stef Pletinck
d6b2c512f7 DNF module only enabled when DNF available and dynamically loads corrections 2017-10-05 16:40:17 +02:00
Stef Pletinck
16de31b9d6 basic dnf module 2017-10-05 10:36:51 +02:00
Vladimir Iakovlev
18992f246a #695: Try to use link with name 2017-09-27 18:21:07 +02:00
Vladimir Iakovlev
cec919374e #695: Fix link to manual-installation 2017-09-27 18:15:44 +02:00
Vladimir Iakovlev
bc7eaff5d1 #695: Fix link to manual-installation 2017-09-27 18:14:29 +02:00
Vladimir Iakovlev
8fb5ba3931 Merge pull request #696 from MattKotsenas/bugfix/params
Support parameters in PowerShell
2017-09-27 19:09:46 +03:00
Vladimir Iakovlev
e94f420cb1 Merge pull request #693 from sQu1rr/master
fixes #692 : multiline PS1 breaking instant mode
2017-09-27 19:09:20 +03:00
Matt Kotsenas
e6496ce8bb Support parameters in PowerShell
Update the PowerShell alias so it passes thefuck parameters (e.g. `-y` or `-r`).
2017-09-26 15:57:13 -07:00
sQu1rr
d34b3ada71 fixes #692 : multiline PS1 breaking instant mode 2017-09-17 16:16:48 +01:00
Vladimir Iakovlev
20779731d3 #N/A: Store not configured usage tracker in tempdir 2017-09-12 08:09:00 +02:00
Vladimir Iakovlev
ec5b69ca63 Merge branch 'reitermarkus-patch-1' 2017-09-10 07:56:45 +02:00
Vladimir Iakovlev
8fbd7c13e4 Merge branch 'patch-1' of https://github.com/reitermarkus/thefuck into reitermarkus-patch-1
# Conflicts:
#	tests/rules/test_brew_upgrade.py
2017-09-10 07:56:33 +02:00
Vladimir Iakovlev
22aa9b701d #682: Measure time spent on log reading 2017-09-09 06:07:08 +02:00
Vladimir Iakovlev
4875d75a64 #682: Ensure that script exists 2017-09-03 10:10:50 +02:00
Vladimir Iakovlev
1cae91b649 #N/A: Get shell from env if possible 2017-09-03 06:51:44 +02:00
Vladimir Iakovlev
50dd4b8f54 #682: Use system temporary directory 2017-09-02 17:35:08 +02:00
Vladimir Iakovlev
84f6d2631e #682: Fix appearance of PS1 in bash 2017-09-02 11:06:40 +02:00
Vladimir Iakovlev
e33960b193 #685: Mention only Python 3 in requirements 2017-09-02 11:02:49 +02:00
Vladimir Iakovlev
ff442a2eb0 #682: Remove script log on exit 2017-09-02 10:44:16 +02:00
Vladimir Iakovlev
17b7bf8ec2 #682: Parse only the last MB of log 2017-09-02 10:39:22 +02:00
Vladimir Iakovlev
bf0867967b #N/A: Cache docker, gem, grunt and yarn output in rules 2017-09-02 10:22:00 +02:00
Vladimir Iakovlev
f20e344663 #N/A: Update apt_invalid_operation rule 2017-09-02 10:11:02 +02:00
Vladimir Iakovlev
badd5a2aff Merge pull request #689 from nvbn/682-instant-fuck-mode
Unify work with output in instant and classic modes
2017-09-02 11:02:34 +03:00
Vladimir Iakovlev
f83e41137b Merge branch 'master' into 682-instant-fuck-mode 2017-09-02 09:31:24 +02:00
Vladimir Iakovlev
f9a4b69362 #N/A: Reorganize entrypoints 2017-09-02 09:30:03 +02:00
Vladimir Iakovlev
e9f48312e4 Merge branch 'master' into 682-instant-fuck-mode 2017-09-01 10:11:58 +02:00
Vladimir Iakovlev
9ba36c9d2a #74: #103: #221: Go back in history if alias is misspelled 2017-09-01 10:11:42 +02:00
Vladimir Iakovlev
2e0b423f2c #682: Add functional tests for instant mode 2017-09-01 07:10:16 +02:00
Vladimir Iakovlev
452ac21603 #682: Update readme 2017-08-31 17:59:38 +02:00
Vladimir Iakovlev
4625d8503d #682: Unify work with output in classic and instant mode 2017-08-31 17:58:56 +02:00
Vladimir Iakovlev
96843fc6cd #N/A: Support relative paths in cache decorator 2017-08-30 15:05:44 +02:00
Vladimir Iakovlev
503c903822 #N/A: Update react_native_command_unrecognized rule 2017-08-30 08:09:13 +02:00
Vladimir Iakovlev
1f1b7da6f4 #682: Warn if PS1 changed after thefuck initialization 2017-08-30 07:44:58 +02:00
Vladimir Iakovlev
db12211e05 Bump to 3.23 2017-08-29 09:39:32 +02:00
Vladimir Iakovlev
7a0db1899c #685: Warn about Python 2 only on Python 2 2017-08-29 09:39:24 +02:00
Vladimir Iakovlev
e5255c3278 Bump to 3.22 2017-08-29 05:02:16 +02:00
Vladimir Iakovlev
d44b11fbd8 #682: Fix gif link 2017-08-28 03:39:17 +02:00
Vladimir Iakovlev
3472026d5e #685: Warn about Python 2 support 2017-08-28 03:38:14 +02:00
Vladimir Iakovlev
bf3c16816d Merge pull request #684 from nvbn/682-instant-fuck-mode
682 instant fuck mode
2017-08-28 04:35:51 +03:00
Vladimir Iakovlev
6fac0622e5 #682: Warn on instant mode with Python 2 2017-08-28 03:21:15 +02:00
Vladimir Iakovlev
1b694fae7b #682: Fix gif link 2017-08-26 14:41:05 +02:00
Vladimir Iakovlev
2ebfb92760 #682: Add gif with instant mode 2017-08-26 14:39:36 +02:00
Vladimir Iakovlev
9cb04ac631 #682: Make warnings more visible 2017-08-26 14:30:19 +02:00
Vladimir Iakovlev
5504b905f3 #682: Fix git_push rule in instant mode 2017-08-26 13:39:38 +02:00
Vladimir Iakovlev
e707728fd5 #682: Update readme 2017-08-26 13:31:09 +02:00
Vladimir Iakovlev
3d98aad5df Merge branch 'master' into 682-instant-fuck-mode 2017-08-26 13:25:59 +02:00
Vladimir Iakovlev
b72ad2907f #682: Allow THEFUCK_INSTANT_MODE=False 2017-08-26 13:21:24 +02:00
Vladimir Iakovlev
7a57355e7e #682: Disable instant mode on Python 2 2017-08-26 13:16:10 +02:00
Vladimir Iakovlev
1132015e60 #682: Rename output to output_readers 2017-08-26 12:45:49 +02:00
Vladimir Iakovlev
0ecc86eda6 #682: Fix aliases in instant mode 2017-08-26 06:29:38 +02:00
Vladimir Iakovlev
c4848d1816 #682: Fix tests in python 2 2017-08-26 06:20:52 +02:00
Vladimir Iakovlev
31becc9456 #682: Fix tests and flake8 2017-08-26 06:16:51 +02:00
Vladimir Iakovlev
cd3a3cd823 #682: Implement instant mode aliases for bash and zsh 2017-08-26 05:46:07 +02:00
Vladimir Iakovlev
f9b30ae2d3 #683: Mention -y and -r in the readme 2017-08-26 04:57:16 +02:00
Vladimir Iakovlev
832ef96188 #681: Lower priority of missing_space_before_subcommand rule 2017-08-25 11:47:17 +02:00
Vladimir Iakovlev
20e678a38a #682: Implement experimental instant mode 2017-08-25 11:44:07 +02:00
Vladimir Iakovlev
f76d2061d1 Merge pull request #680 from simonwhitaker/patch-1
Fix docs for Command type
2017-08-23 09:37:13 +03:00
Simon Whitaker
16ec6a7d2a Fix docs for Command type 2017-08-23 07:14:56 +01:00
Vladimir Iakovlev
6c4333944f Bump to 3.21 2017-08-21 12:26:19 +02:00
Vladimir Iakovlev
31f5185642 Merge pull request #679 from nvbn/678-speedup-thefuck-alias
678 speedup thefuck
2017-08-21 13:25:33 +03:00
Vladimir Iakovlev
d71dbc5de4 #678: Speedup fuck by hardcoding entry points 2017-08-21 11:55:34 +02:00
Vladimir Iakovlev
fabef80056 #678: Import pkg_resources only when it needed 2017-08-21 11:50:04 +02:00
Vladimir Iakovlev
b4c4fdf706 #678: Use fastentrypoints 2017-08-21 11:32:23 +02:00
Vladimir Iakovlev
d267488520 Bump to 3.20 2017-08-16 11:28:59 +02:00
Vladimir Iakovlev
e31124335f #658: Ensure that history isn't empty in autoconfiguration 2017-08-16 11:26:43 +02:00
Vladimir Iakovlev
71a5182b9a Merge pull request #676 from nvbn/662-fix-autoconfig
#662: Autoconfigure when `fuck` was called < 60 seconds ago from the same shell
2017-08-08 17:36:10 +02:00
Vladimir Iakovlev
6a096155dc #662: Autoconfigure when fuck was called < 60 seconds ago from the same shell 2017-08-08 16:13:37 +02:00
Vladimir Iakovlev
5742d2d910 #N/A: Use real PATH in tests 2017-08-03 12:30:04 +02:00
Vladimir Iakovlev
754bb3e21f #N/A: Reset environment variables in tests 2017-08-03 12:18:05 +02:00
Vladimir Iakovlev
2bbba9a0c8 Bump to 3.19 2017-08-03 11:34:01 +02:00
Vladimir Iakovlev
b978c3793e Merge pull request #669 from tomoshi0809/master
#630 Catching the escaped space in filenames
2017-07-22 20:11:03 +02:00
KEI
8a83b30e73 Corrected the part for splitting a command 2017-07-19 00:09:21 +09:00
Markus Reiter
50db76c019 Update README.md 2017-07-06 00:21:31 +02:00
Markus Reiter
a1da33493e Delete test_brew_upgrade.py 2017-07-06 00:20:46 +02:00
Markus Reiter
916dfae6dd Remove brew upgrade --all rule. 2017-07-06 00:10:27 +02:00
Vladimir Iakovlev
fd20a3f832 Merge pull request #657 from josephfrazier/git_not_command-wording
Update stderr wording of git_not_command
2017-06-19 23:12:46 +02:00
Joseph Frazier
b6ed499103 Make git_not_command stderr detection backward-compatible 2017-06-06 13:56:13 -04:00
Joseph Frazier
76600cf40a Update stderr wording of git_not_command
This changed in git v2.13.1, see
6c48686263 (diff-081cf476dd9ac3b05c183570de47cb23)
2017-06-05 17:29:42 -04:00
Vladimir Iakovlev
e62666181a #650: #651: #646: Recommend to install thefuck globally 2017-05-29 10:11:15 +02:00
Vladimir Iakovlev
c88b0792b8 Bump to 3.18 2017-05-10 16:51:19 +02:00
Vladimir Iakovlev
06a89427e2 #N/A: Fix bash alias on ci 2017-05-10 16:40:57 +02:00
Vladimir Iakovlev
3a134f250d Bump to 3.17 2017-05-10 15:34:06 +02:00
Vladimir Iakovlev
b54cdf7c49 #637: Suggest yarn add on yarn require 2017-05-10 15:32:11 +02:00
Vladimir Iakovlev
1b05a497e8 #635: Show "Nothing found" instead of 'No fucks given' when different alias are used 2017-05-10 15:22:26 +02:00
Vladimir Iakovlev
79602383ec #549: Fix aliases with bash 2017-05-10 15:14:01 +02:00
Vladimir Iakovlev
84c42168df #N/A: Add new line after version 2017-05-10 15:06:29 +02:00
Vladimir Iakovlev
f53d772ac3 Merge pull request #640 from bam241/add_macport_to_sudo
fix sudo.py for macport
2017-05-03 12:08:53 +04:00
Mouginot B
93d4a4fc3a fix sudo.py for macport 2017-05-02 17:36:35 -05:00
Vladimir Iakovlev
2cb23b1805 #N/A: Fix docstring 2017-05-01 17:49:13 +02:00
Vladimir Iakovlev
33f28cf76d #633: Show ci badges for master 2017-04-20 21:34:47 +02:00
Vladimir Iakovlev
6322dbd9ed #N/A: Fix flake8 warnings 2017-04-10 23:23:23 +02:00
Vladimir Iakovlev
fc09818351 Bump to 3.16 2017-04-10 23:16:06 +02:00
Vladimir Iakovlev
2788ef1471 #N/A: Make missing_space_before_subcommand handle aliases correctly 2017-04-10 23:15:12 +02:00
Vladimir Iakovlev
ef3aabe7c5 Merge branch '614-repeate-option' 2017-03-28 18:51:25 +02:00
Vladimir Iakovlev
2af54d036d #623: Fix UnicodeDecodeError with Python 2 2017-03-28 18:50:51 +02:00
Vladimir Iakovlev
99c10b50ff Merge branch 'dfadev-master' 2017-03-28 18:35:54 +02:00
Vladimir Iakovlev
802fcd96fd #621: Refine yarn_command_replaced rule tests 2017-03-28 18:35:40 +02:00
Russ Panula
900e83e028 add rule for: yarn install [pkg]
--- `install` has been replaced with `add` to add new dependencies. Run $0 instead.

6e9a9a6596/src/reporters/lang/en.js (L18)
2017-03-28 18:31:01 +02:00
Joseph Frazier
d41cbb6810 Fix heroku_not_command for new stderr format
heroku updated its command suggestion formatting, so account for that.
For example:

    $ heroku log
     ▸    log is not a heroku command.
     ▸    Perhaps you meant logs?
     ▸    Run heroku _ to run heroku logs.
     ▸    Run heroku help for a list of available commands.
    $ fuck
    heroku logs [enter/↑/↓/ctrl+c]
2017-03-28 18:31:01 +02:00
Vladimir Iakovlev
b36cf59b46 #614: Refine argument_parser 2017-03-28 18:18:01 +02:00
Vladimir Iakovlev
cfa831c88d #614: Add --repeat option 2017-03-28 18:09:38 +02:00
Vladimir Iakovlev
818d06fb95 Merge pull request #622 from josephfrazier/heroku-format
Fix heroku_not_command for new stderr format
2017-03-28 16:56:03 +04:00
Vladimir Iakovlev
c3eca8234a #620: Add --debug 2017-03-28 13:09:11 +02:00
Vladimir Iakovlev
d47ff8cbf2 #620: Fix functional tests 2017-03-28 12:28:34 +02:00
Vladimir Iakovlev
1a52e98fbd #620: Fix code style 2017-03-28 12:25:33 +02:00
Vladimir Iakovlev
53c11d2ef4 #620: Fix python 2 support 2017-03-28 12:08:32 +02:00
Vladimir Iakovlev
beda1854cf #620: Add bash support 2017-03-28 12:01:09 +02:00
Vladimir Iakovlev
7532c65c62 #620: Fix aliases with zsh 2017-03-28 11:38:28 +02:00
Vladimir Iakovlev
ec37998a10 #620: Add support of arguments to fuck, like fuck -y on zsh 2017-03-28 11:31:06 +02:00
Joseph Frazier
58d5eff6d0 Fix heroku_not_command for new stderr format
heroku updated its command suggestion formatting, so account for that.
For example:

    $ heroku log
     ▸    log is not a heroku command.
     ▸    Perhaps you meant logs?
     ▸    Run heroku _ to run heroku logs.
     ▸    Run heroku help for a list of available commands.
    $ fuck
    heroku logs [enter/↑/↓/ctrl+c]
2017-03-26 15:55:03 -04:00
Vladimir Iakovlev
d28567bb31 #585: Fix suggestion of .bash_profile 2017-03-23 16:55:24 +01:00
Vladimir Iakovlev
b016bb2255 Merge pull request #619 from josephfrazier/yarn-alias-scripts
Extend yarn_alias rule to handle package.json scripts
2017-03-23 19:39:11 +04:00
Joseph Frazier
bf109ee548 Extend yarn_alias rule to handle package.json scripts
For example, if an "etl" script is defined in package.json, it can be
run with `yarn etl`. However, if `yarn etil` is run, `yarn` will
suggest the correction. This change lets `thefuck` take advantage of
that:

    $ yarn etil
    yarn etil v0.21.3
    error Command "etil" not found. Did you mean "etl"?
    $ fuck
    yarn etl [enter/?/?/ctrl+c]
2017-03-22 16:52:30 -04:00
Vladimir Iakovlev
1aaaca1220 Merge branch 'Asday-master' 2017-03-22 14:00:18 +01:00
Vladimir Iakovlev
b096560469 #618: Refine git_push_without_commits rule 2017-03-22 14:00:03 +01:00
Vladimir Iakovlev
5b1f3ff816 Merge branch 'master' of git://github.com/Asday/thefuck into Asday-master 2017-03-22 13:57:18 +01:00
Vladimir Iakovlev
c5f7c89222 Merge pull request #617 from josephfrazier/git-stash-add-updated
git_stash_pop: Add only updated files
2017-03-22 15:25:25 +04:00
Adam Barnes
e61271dae3 Removed another unused import.
Goodness.
2017-03-22 10:59:27 +00:00
Adam Barnes
bddb43b987 Removed an unused import. 2017-03-22 10:29:50 +00:00
Adam Barnes
b22a3ac891 Created a rule for trying to push a new repository with no commits. 2017-03-22 10:23:35 +00:00
Joseph Frazier
f4cc88f6c7 git_stash_pop: Add only updated files
This avoids adding untracked files to the repo. See here for a
description of the difference between `git add .` and `git add --update`:

https://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add/572660#572660
2017-03-21 20:12:15 -04:00
Vladimir Iakovlev
5734412d82 Bump to 3.15 2017-03-14 16:38:07 +01:00
Vladimir Iakovlev
24588b23e2 #N/A: Add .tox to flake8 exclude 2017-03-14 11:14:23 +01:00
Vladimir Iakovlev
825f7986c7 #322: Use unicode in vagrant_up rule 2017-03-14 11:13:43 +01:00
Vladimir Iakovlev
971c7e1b3f #322: Add vagrant to slow commands 2017-03-14 11:13:10 +01:00
Vladimir Iakovlev
8375b78877 #N/A: Use unicode in all log functions 2017-03-14 09:49:36 +01:00
Vladimir Iakovlev
6f39edc155 #611: Force use MagicMock in tests 2017-03-13 23:35:57 +01:00
Vladimir Iakovlev
408cb5fa09 #611: Fix python 2 support 2017-03-13 23:26:57 +01:00
Vladimir Iakovlev
2315929875 #579: Add missing_space_before_subcommand rule 2017-03-13 22:21:34 +01:00
Vladimir Iakovlev
14a9cd85aa #611: Allow to configure alias automatically by calling fuck twice 2017-03-13 21:50:13 +01:00
Vladimir Iakovlev
2379573cf2 #591: Add path_from_history rule 2017-03-13 19:05:34 +01:00
Vladimir Iakovlev
350be285b8 #591: Treat builtin commands as executables 2017-03-13 18:27:01 +01:00
Vladimir Iakovlev
76aa5546df #593: Remove unned underscores from readme 2017-03-13 17:22:58 +01:00
Vladimir Iakovlev
5179015b84 #531: Add example of alias for running without confirmation to readme 2017-03-13 16:59:29 +01:00
Vladimir Iakovlev
dee99ed705 #220: Use pip3 install --user for upgrade too 2017-03-13 14:15:24 +01:00
Vladimir Iakovlev
e101f1fcc9 #220: Use pip3 install --user in readme 2017-03-13 14:01:38 +01:00
Vladimir Iakovlev
73b884df5f Merge branch 'ds-forks-master' 2017-03-13 13:53:55 +01:00
Vladimir Iakovlev
9e8b4f594d #602: Little cleanup 2017-03-13 13:53:43 +01:00
Vladimir Iakovlev
c2b597f22b Merge branch 'master' of https://github.com/ds-forks/thefuck into ds-forks-master 2017-03-13 13:47:56 +01:00
Vladimir Iakovlev
8c783b7405 Merge branch 'awonnacott-master' 2017-03-13 13:47:10 +01:00
Vladimir Iakovlev
3efa42ec06 Merge branch 'master' of https://github.com/awonnacott/thefuck into awonnacott-master 2017-03-13 13:45:45 +01:00
Vladimir Iakovlev
02bcd8331d Merge branch 'josephfrazier-flake8' 2017-03-13 13:39:16 +01:00
Vladimir Iakovlev
bd750ff9a3 #563: Exclude build from flake8 check 2017-03-13 13:39:00 +01:00
Vladimir Iakovlev
725ef271b1 Merge branch 'flake8' of https://github.com/josephfrazier/thefuck into josephfrazier-flake8
# Conflicts:
#	thefuck/system/unix.py
#	thefuck/system/win32.py
2017-03-13 13:35:11 +01:00
Vladimir Iakovlev
d2f8cebfd8 Merge branch 'josephfrazier-yarn_help' 2017-03-13 13:32:02 +01:00
Vladimir Iakovlev
c7d7a6d1d7 #612: Little cleanup 2017-03-13 13:30:07 +01:00
Joseph Frazier
4b53b1d3e3 Support Linux/Windows in yarn_help rule
See https://www.dwheeler.com/essays/open-files-urls.html
and https://stackoverflow.com/questions/5226958/which-equivalent-function-in-python/15133367#15133367
2017-03-10 15:22:48 -05:00
Joseph Frazier
35ea4dce71 Add yarn_help rule
Yarn likes to keep its documentation online, rather than in `yarn help`
output. For example, `yarn help clean` doesn't tell you anything about
the `clean` subcommand. Instead, it points you towards
https://yarnpkg.com/en/docs/cli/clean

This rule detects when that happens, and suggests opening the URL. One
caveat is the currently only OSX is supported, as Linux uses `xdg-open`
instead of `open`.
2017-03-10 13:07:46 -05:00
Joseph Frazier
2fea1f3846 Run flake8 on AppVeyor 2017-03-10 12:18:59 -05:00
Joseph Frazier
e009f0a05b Fix flake8 errors: E305 expected 2 blank lines after class or function definition 2017-03-08 19:53:54 -05:00
Joseph Frazier
78515c7bbb Fix flake8 errors: W391 blank line at end of file 2017-03-08 12:43:34 -05:00
Joseph Frazier
62a845fd94 fixup! Fix flake8 errors: E302 expected 2 blank lines, found 1 2017-03-08 12:43:05 -05:00
Joseph Frazier
2c7ce91dd5 Fix flake8 errors: F401 'sys' imported but unused 2017-03-08 12:42:24 -05:00
Joseph Frazier
c775937d17 fixup! Fix flake8 errors: E101/W191 indentation contains (mixed spaces and) tabs 2017-03-08 12:40:11 -05:00
Joseph Frazier
aaf01394db fixup! Fix flake8 errors: E126 continuation line over-indented for hanging indent 2017-03-08 12:39:24 -05:00
Joseph Frazier
0b0a2220a0 fixup! Ignore flake8 errors with inline comments: W291 trailing whitespace 2017-03-08 12:34:49 -05:00
Joseph Frazier
b038ea4541 Merge branch 'master' into flake8 2017-03-08 12:21:54 -05:00
Vladimir Iakovlev
7d3ddfc8d9 Merge branch 'josephfrazier-yarn-command-not-found' 2017-03-06 17:32:34 +01:00
Vladimir Iakovlev
02f3250d39 #609: Use replace_command in yarn_command_not_found 2017-03-06 17:31:57 +01:00
Joseph Frazier
df5428c5e4 Add yarn_command_not_found rule
This addresses https://github.com/nvbn/thefuck/pull/607#issuecomment-283945505

The code was adapted from the `grunt_task_not_found` rule
2017-03-03 23:38:20 -05:00
Vladimir Iakovlev
ef5ff6210a Merge pull request #606 from josephfrazier/git-rm-staged
Add git_rm_staged rule for removing locally staged changes
2017-03-03 13:52:43 +01:00
Vladimir Iakovlev
fbb73f262b Merge pull request #607 from josephfrazier/yarn-alias
Fix aliased `yarn` commands like `yarn ls`
2017-03-03 13:50:58 +01:00
Vladimir Iakovlev
20246e5be6 Merge pull request #608 from MattKotsenas/bugfix/no-history
Update PowerShell alias to handle no history
2017-03-03 13:45:23 +01:00
Matt Kotsenas
4669a033ee Update PowerShell alias to handle no history
If history is cleared (or the shell is new and there is no history),
invoking thefuck results in an error because the alias attempts to execute
the usage string.

The fix is to check if Get-History returns anything before invoking
thefuck.
2017-03-01 09:36:30 -08:00
Joseph Frazier
7e16a2eb7c Fix aliased yarn commands like yarn ls
[Yarn] has a handful of subcommand [aliases], but does not automatically
[correct] them for the user. This makes it so that `fuck` will do the
trick. For example:

    $ yarn ls
    yarn ls v0.20.3
    error Did you mean `yarn list`?
    info Visit https://yarnpkg.com/en/docs/cli/list for documentation about this command.
    $ fuck
    yarn list [enter/?/?/ctrl+c]

[Yarn]: https://yarnpkg.com/en/
[aliases]: 0adbc59b18/src/cli/aliases.js
[correct]: https://github.com/yarnpkg/yarn/pull/1044#issuecomment-253763230
2017-02-26 20:50:41 -05:00
Joseph Frazier
42ec01dab1 Add git_rm_staged rule for removing locally staged changes
It would be nice if `thefuck` could help me `git rm` a file I had
already staged. This rule, adapted from `git_rm_local_modifications`,
does that.
2017-02-26 19:16:15 -05:00
Vladimir Iakovlev
91c27e1a62 Merge pull request #605 from andrew-epstein/master
Improve performance of history rule
2017-02-24 13:46:56 +01:00
Andrew Epstein
778f2bdf1a Improve performance of history rule 2017-02-22 07:56:40 -05:00
Vladimir Iakovlev
e893521872 #N/A: Run coveralls only on full test run (python 3.6 with linux) 2017-02-09 16:13:09 +01:00
Vladimir Iakovlev
bbed17fe07 #N/A: Add sudo_command_from_user_path rule 2017-02-09 16:09:37 +01:00
dhilipsiva
309fe8f6ee Fix test cases 2017-02-09 09:16:20 +05:30
dhilipsiva
8a8ade1e6b Fix regex 2017-02-09 08:52:20 +05:30
dhilipsiva
7f9025c7ad Make Changes suggested by @nvbn
* remove comments/doctrings at the top of files;
* move sudo-related stuff to sudo rule;
* for no_command case try to find most similar command, like, for example, in react_native_command_unrecognized rule.
2017-02-09 08:46:54 +05:30
Vladimir Iakovlev
6f842ab747 Merge pull request #604 from wbolster/add-colemak-nav-bindings
add support for colemak style vi bindings
2017-02-08 13:01:28 +01:00
wouter bolsterlee
ae68bcbac1 add support for colemak style vi bindings
this allows e/n in addition to j/k (same places on the keyboard on
colemak and qwerty) to be used as arrow keys when selecting a command
from the suggested fixups.

fixes #603
2017-02-08 12:06:11 +01:00
dhilipsiva
fb07cdfb4a Add hostscli to readme 2017-02-05 14:58:36 +05:30
dhilipsiva
55dcf06569 Hostscli 2017-02-05 14:50:36 +05:30
Vladimir Iakovlev
28a0150e45 Merge branch 'juzim-apt_get_not_installed' 2017-01-30 13:06:34 +01:00
Vladimir Iakovlev
430a7135af #599: Remove unused import 2017-01-30 13:06:19 +01:00
Vladimir Iakovlev
ff2be6c9a3 Merge branch 'apt_get_not_installed' of git://github.com/juzim/thefuck into juzim-apt_get_not_installed 2017-01-30 13:03:28 +01:00
Vladimir Iakovlev
4748776296 Merge pull request #598 from josephfrazier/git_add_force
Add git_add_force rule
2017-01-30 13:02:20 +01:00
Vladimir Iakovlev
1885196a11 Merge pull request #597 from josephfrazier/readme-git_stash-typo
README.md: fix typo in git_stash description
2017-01-30 13:00:42 +01:00
Vladimir Iakovlev
c127040a4c Merge pull request #596 from josephfrazier/git-tag-force
Add git_tag_force rule
2017-01-30 13:00:19 +01:00
Julian Zimmermann
ac7b633e28 Added support for "not installed" message in apt_get 2017-01-29 00:15:55 +01:00
Joseph Frazier
4d0388b53c Add git_add_force rule
This adds `--force` to `git add` when needed. For example:

    $ git add dist/*.js
    The following paths are ignored by one of your .gitignore files:
    dist/app.js
    dist/background.js
    dist/options.js
    Use -f if you really want to add them.
    $ fuck
    git add --force dist/app.js dist/background.js dist/options.js [enter/↑/↓/ctrl+c]
    $
2017-01-28 13:26:40 -05:00
Joseph Frazier
8da4dce5f2 Add git_tag_force rule
This adds `--force` to `git tag` when needed. For example:

    $ git tag alert
    fatal: tag 'alert' already exists
    $ fuck
    git tag --force alert [enter/↑/↓/ctrl+c]
    Updated tag 'alert' (was dec6956)
    $
2017-01-28 13:26:14 -05:00
Joseph Frazier
ace6e88269 README.md: fix typo in git_stash description
from "stashes you local modifications"
to   "stashes your local modifications"
2017-01-27 19:44:40 -05:00
Vladimir Iakovlev
a015c0f5e2 #N/A: Add gem unknown command rule 2017-01-15 15:14:53 +01:00
Vladimir Iakovlev
dbe324bcd8 #587: Add scm correction rule 2017-01-15 14:40:50 +01:00
Vladimir Iakovlev
8447b5caa2 #585: Add note about reloading changes in how to configure message 2017-01-15 14:03:09 +01:00
Vladimir Iakovlev
3a9942061d Bump to 3.14 2017-01-11 15:05:29 +01:00
Vladimir Iakovlev
a65f90813b Bump to 3.13 2017-01-11 14:59:18 +01:00
Vladimir Iakovlev
a778ea6203 #588: Stop using bashlex 2017-01-11 14:58:50 +01:00
Vladimir Iakovlev
03a828d586 Bump to 3.12 2017-01-09 18:17:50 +01:00
Vladimir Iakovlev
4a0d71c1c4 #N/A: Add ifconfig_device_not_found rule 2017-01-09 18:13:37 +01:00
Vladimir Iakovlev
a6f63c0568 #580: Use bashlex in generic shell 2017-01-09 17:50:23 +01:00
Vladimir Iakovlev
d1b9492085 Merge pull request #586 from duboviy/master
Add Python 3.6 support
2017-01-09 17:38:37 +01:00
Eugene Duboviy
993a661c60 Update .travis.yml 2017-01-08 17:13:22 +02:00
Eugene Duboviy
bc9121cb13 Update appveyor.yml 2017-01-08 17:08:38 +02:00
Eugene Duboviy
7db140c456 Update tox.ini 2017-01-08 17:06:45 +02:00
Vladimir Iakovlev
e313ff73a9 Merge pull request #582 from josephfrazier/git_stash_pop
Fix `git stash pop` with local changes
2016-12-22 14:02:05 +01:00
Joseph Frazier
8c62706db4 Fix git stash pop with local changes
When there are local changes to a file, and a git stash is popped that
contains other changes to that same file, git fails as follows:

    $ git stash pop
    error: Your local changes to the following files would be overwritten by merge:
            src/index.js
    Please commit your changes or stash them before you merge.
    Aborting
    $

This change adds a rule that corrects this problem as suggested [here]:

    $ git stash pop
    error: Your local changes to the following files would be overwritten by merge:
            src/index.js
    Please commit your changes or stash them before you merge.
    Aborting
    $ fuck
    git add . && git stash pop && git reset . [enter/↑/↓/ctrl+c]
    Auto-merging src/index.js
    On branch flow
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)

            modified:   src/index.js

    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)

            modified:   src/index.js

    Dropped refs/stash@{0} (f94776d484c4278997ac6837a7b138b9b9cdead1)
    Unstaged changes after reset:
    M        src/index.js
    $

[here]: https://stackoverflow.com/questions/15126463/how-do-i-merge-local-modifications-with-a-git-stash-without-an-extra-commit/15126489#15126489
2016-12-11 12:44:04 -05:00
Vladimir Iakovlev
6baa7f650e Merge pull request #580 from josephfrazier/bash-command-substitution
bash: fix parsing of command substitution
2016-11-30 15:49:47 +01:00
Joseph Frazier
4ae32cf4ee bash: use generic shell's UTF-8 methods 2016-11-23 22:42:16 -05:00
Joseph Frazier
385746850e generic shell: extract UTF-8 encoding/decoding into methods 2016-11-23 07:53:22 -05:00
Joseph Frazier
4f87141f0c bash: fallback to generic parser if bashlex fails 2016-11-23 07:43:25 -05:00
Joseph Frazier
dbedcc7aa6 Test parsing bash arithmetic expressions 2016-11-23 07:36:58 -05:00
Vladimir Iakovlev
e0b5d47fa5 Merge pull request #578 from scorphus/fish-builtin-history
#577: Use builtin `history` in Fish function
2016-11-22 12:03:06 +01:00
Joseph Frazier
ca44ee0640 bash: use bashlex for split_command, not shlex 2016-11-18 14:43:07 -05:00
Joseph Frazier
892e8a8e65 Test parsing bash command substitution
This is to help address bad corrections like the following (note the
position of the -p flag):

    thefuck 'git log $(git ls-files thefuck | grep python_command) -p'
    git log $(git ls-files thefuck | grep -p python_command) [enter/↑/↓/ctrl+c]
2016-11-18 14:43:00 -05:00
Pablo Santiago Blum de Aguiar
a947259eef #577: Use builtin history in Fish function
Fix #577
2016-11-17 22:57:11 -02:00
Vladimir Iakovlev
785cb83ff3 Merge branch 'josephfrazier-git-flag-after-filename' 2016-11-08 23:53:50 +01:00
Vladimir Iakovlev
aec8fe3233 #570: Refine tests 2016-11-08 23:53:40 +01:00
Vladimir Iakovlev
c21dbd2be3 Merge branch 'git-flag-after-filename' of https://github.com/josephfrazier/thefuck into josephfrazier-git-flag-after-filename 2016-11-08 23:48:40 +01:00
Andrew Wonnacott
b4fda04acb Now only return [] when correct error was caught 2016-11-03 03:46:27 -04:00
Andrew Wonnacott
5f6c55d839 Fix issue with attempting to scroll through options when not-found package has no packages with matching names causing crash. 2016-11-03 03:34:41 -04:00
Vladimir Iakovlev
6173913291 Merge pull request #572 from josephfrazier/ls_all
Suggest `ls -A` when `ls` has no output
2016-11-01 12:51:04 +01:00
Vladimir Iakovlev
6f0d1e287d #571: Don't put empty string in history in zsh 2016-10-31 18:52:48 +01:00
Joseph Frazier
756044e087 Suggest ls -A when ls has no output 2016-10-31 13:49:38 -04:00
Vladimir Iakovlev
ddd8788353 #571: always honor alter_history setting in zsh 2016-10-31 12:57:31 +01:00
Vladimir Iakovlev
76c0e7bc70 Merge pull request #571 from josephfrazier/bash-honor-alter-history
bash: always honor alter_history setting
2016-10-31 12:56:31 +01:00
Vladimir Iakovlev
4865bdd81f Merge pull request #569 from scorphus/rebase-skip
#N/A: Add `git_rebase_merge_dir` rule
2016-10-31 12:55:05 +01:00
Joseph Frazier
fa169c686c test_git_flag_after_filename.py: dedupe test commands 2016-10-31 00:22:24 -04:00
Joseph Frazier
9cae0bffff git_flag_after_filename: fix flake8 errors
These were found by creating a `.flake8` file containing:

    [flake8]
    ignore = E501,W503
    exclude = venv

then running:

    flake8 $(git diff master... --name-only)

See https://github.com/nvbn/thefuck/pull/563 for running `flake8` in CI
2016-10-31 00:22:24 -04:00
Joseph Frazier
b519d317f7 bash: always honor alter_history setting
This ensures that even if the command suggested and run by `thefuck`
fails, it will still be added to the history, allowing the user to tweak
it further (or run `fuck` again) if desired.

Note that the fish shell appears to already behave this way.
2016-10-30 23:17:52 -04:00
Joseph Frazier
5b420204c9 git: fix fatal: bad flag '...' after filename
For example:

    $ git log README.md -p
    fatal: bad flag '-p' used after filename
    $ fuck
    git log -p README.md [enter/↑/↓/ctrl+c]
    Aborted

    $ git log -p README.md --name-only
    fatal: bad flag '--name-only' used after filename
    $ fuck
    git log -p --name-only README.md [enter/↑/↓/ctrl+c]
    Aborted

    $ git log README.md -p CONTRIBUTING.md
    fatal: bad flag '-p' used after filename
    $ fuck
    git log -p README.md CONTRIBUTING.md [enter/↑/↓/ctrl+c]
2016-10-30 21:40:25 -04:00
Pablo Santiago Blum de Aguiar
07005b591a #N/A: Add git_rebase_merge_dir rule 2016-10-30 20:30:26 -02:00
Vladimir Iakovlev
cb99e42e02 Merge pull request #567 from scorphus/git-rm-local-modifications
#N/A: Add `git_rm_local_modifications` rule
2016-10-30 19:51:20 +01:00
Vladimir Iakovlev
51f77964c6 Merge pull request #568 from scorphus/osx-brew-install
#N/A: Do not fail if formula is already installed
2016-10-30 19:50:02 +01:00
Pablo Santiago Blum de Aguiar
30b1c44f91 #N/A: Do not fail if formula is already installed 2016-10-30 15:02:12 -02:00
Pablo Santiago Blum de Aguiar
af28f0334a #N/A: Add git_rm_local_modifications rule 2016-10-29 17:51:55 -02:00
Vladimir Iakovlev
5ee5439c1e #565: Refine git_push rule 2016-10-08 12:24:48 +02:00
Vladimir Iakovlev
cf006dac2c Merge branch 'master' into josephfrazier-git-push-u
# Conflicts:
#	thefuck/rules/git_push.py
2016-10-08 12:20:23 +02:00
Vladimir Iakovlev
5b535077bf #N/A: Stop changing Command inside rules 2016-10-08 12:18:33 +02:00
Joseph Frazier
dda9d55989 Add flake8 instructions to README.md
Also add flake8 to requirements.txt so that it will be installed by:

    pip install -r requirements.txt
2016-10-07 22:27:07 -04:00
Joseph Frazier
f0b9c7cb67 Ignore remaining flake8 rules and exclude ./venv/
This should fix the builds.
2016-10-07 22:27:07 -04:00
Joseph Frazier
521eb03d7a Fix flake8 errors: E127 continuation line over-indented for visual indent 2016-10-07 22:27:07 -04:00
Joseph Frazier
e0cab4fa1b Fix flake8 errors: E126 continuation line over-indented for hanging indent 2016-10-07 22:27:07 -04:00
Joseph Frazier
1b30c00546 Fix flake8 errors: E122 continuation line missing indentation or outdented 2016-10-07 22:27:07 -04:00
Joseph Frazier
a9d55e9c62 Fix flake8 errors: E128 continuation line under-indented for visual indent
See https://github.com/nvbn/thefuck/pull/563#discussion_r82492221
2016-10-07 22:26:57 -04:00
Vladimir Iakovlev
cf3acbfa2e Merge branch 'git-push-u' of https://github.com/josephfrazier/thefuck into josephfrazier-git-push-u 2016-10-07 10:40:02 +02:00
Vladimir Iakovlev
4d714994a3 Merge pull request #564 from josephfrazier/docker-python
Use official Python images for Docker tests
2016-10-07 10:38:49 +02:00
Vladimir Iakovlev
02f717a0e8 Merge pull request #562 from josephfrazier/man-help
Suggest `foo --help` when `man foo` shows no pages
2016-10-07 10:37:33 +02:00
Vladimir Iakovlev
8f4f2f03a7 Merge pull request #561 from josephfrazier/ag-literal
Suggest `ag -Q` when relevant
2016-10-07 10:35:34 +02:00
Joseph Frazier
432878bd77 Ignore flake8 errors with inline comments: W291 trailing whitespace
See https://github.com/PyCQA/pycodestyle/pull/243
2016-10-06 15:31:55 -04:00
Joseph Frazier
fb3d8d1e01 Ignore flake8 errors with inline comments: F401,F403 2016-10-06 15:31:55 -04:00
Joseph Frazier
c4c6f506f4 Ignore flake8 errors with inline comments: E402 module level import not at top of file
https://github.com/nvbn/thefuck/pull/563#discussion_r82105200
2016-10-06 15:31:55 -04:00
Joseph Frazier
725605cd20 Fix flake8 errors: E711 comparison to None should be 'if cond is not None:' 2016-10-06 15:31:55 -04:00
Joseph Frazier
797b42cfd7 Fix flake8 errors: E302 expected 2 blank lines, found 1 2016-10-06 15:31:55 -04:00
Joseph Frazier
37161832aa Fix flake8 errors: E123 closing bracket does not match indentation of opening bracket's line 2016-10-06 15:31:55 -04:00
Joseph Frazier
b221b04d0f Fix flake8 errors: F811 redefinition of unused... 2016-10-06 15:31:55 -04:00
Joseph Frazier
dcc13bd2d2 Fix flake8 errors: F841, E265
This commented-out test caused a couple flake8 errors, so get rid of it:
* F841 local variable 'cmd' is assigned to but never used
* E265 block comment should start with '# '

See https://github.com/nvbn/thefuck/pull/563#discussion_r82104360
2016-10-06 15:30:53 -04:00
Joseph Frazier
283eb09c19 Fix flake8 errors: E231 missing whitespace after ',' 2016-10-06 13:30:39 -04:00
Joseph Frazier
10d409e6e2 Fix flake8 errors: E225 missing whitespace around operator 2016-10-06 13:30:13 -04:00
Joseph Frazier
93302c74b5 Fix flake8 errors: E101/W191 indentation contains (mixed spaces and) tabs 2016-10-06 13:30:13 -04:00
Joseph Frazier
22b005cebb Fix flake8 errors: E731 do not assign a lambda expression, use a def 2016-10-06 13:30:05 -04:00
Joseph Frazier
feb36ede5c Fix suggestion for git push -u
This was broken by https://github.com/nvbn/thefuck/pull/559
2016-10-06 13:09:40 -04:00
Joseph Frazier
16a440cb9d test_zsh.py: use official python images, not ubuntu
This should help reduce build times.
2016-10-06 11:15:18 -04:00
Joseph Frazier
10b20574d1 test_tcsh.py: use official python images, not ubuntu
This should help reduce build times.
2016-10-06 11:12:38 -04:00
Joseph Frazier
91fceb401a test_fish.py: use official python images, not ubuntu
This should help reduce build times.
2016-10-06 11:09:19 -04:00
Joseph Frazier
4b79e23ba7 test_bash.py: use official python images, not ubuntu
This should help reduce build times.
2016-10-06 10:56:37 -04:00
Joseph Frazier
f915a6ed0c test_performance.py: use python:3 image, not ubuntu
This should help reduce build times.
2016-10-06 10:54:47 -04:00
Joseph Frazier
e9d29726bc Run flake8 using Travis CI 2016-10-05 11:00:39 -04:00
Joseph Frazier
a964af7e95 ag_literal.py: use endswith() rather than in
https://github.com/nvbn/thefuck/pull/561#discussion_r81898499
2016-10-05 10:55:49 -04:00
Joseph Frazier
77fc021a6c Refactor tests/rules/test_ag_literal.py
https://github.com/nvbn/thefuck/pull/561#discussion_r81894710
2016-10-05 10:52:24 -04:00
Joseph Frazier
4822ceb87a ag_literal.py: remove unused import (Flake8 F401)
https://github.com/nvbn/thefuck/pull/561#discussion_r81892699
2016-10-05 10:34:17 -04:00
Joseph Frazier
b2947aba8d test_ag_literal.py: Add blank line (PEP 8 E302)
https://github.com/nvbn/thefuck/pull/561#discussion_r81892174
2016-10-05 10:32:14 -04:00
Joseph Frazier
d2e0a19aae Add missing semicolon to aws_cli entry in README 2016-10-03 14:22:17 -04:00
Joseph Frazier
0c84eefa55 Don't suggest man 2/3 foo if no man pages exist
Suggest `foo --help` instead. However, if there are man pages, suggest
`foo --help` after `man 2/3 foo`

This addresses the comment in the previous commit message:

> However, in cases where multiple sections have man pages for `foo`,
> running `man foo` could bring up the "wrong" section of man pages.
> `man read` is an example of this, but that should probably be handled in
> a way that still suggests `foo --help` first when there are *no* man
> pages for `foo` in any section.
2016-10-03 14:10:42 -04:00
Joseph Frazier
8bd6c5da67 For man foo, try foo --help before man 3 foo
`man` without a section searches all sections, so having `foo --help`
suggested first makes more sense than adding a specific section. See
https://github.com/nvbn/thefuck/pull/562#issuecomment-251142710

However, in cases where multiple sections have man pages for `foo`,
running `man foo` could bring up the "wrong" section of man pages.
`man read` is an example of this, but that should probably be handled in
a way that still suggests `foo --help` first when there are *no* man
pages for `foo` in any section.

Closes https://github.com/nvbn/thefuck/issues/546
2016-10-03 12:03:57 -04:00
Vladimir Iakovlev
ce6b82c92d #560: Fix code style 2016-10-03 13:07:30 +02:00
Joseph Frazier
5dbbb3b1ed Add ... --help to man suggestions
This is along the lines of what @waldyrious suggested in
https://github.com/nvbn/thefuck/issues/546, but it just adds a new
suggestion rather than replacing the other ones.
2016-10-03 03:57:53 -04:00
Joseph Frazier
db4b37910d Suggest ag -Q when relevant
This detects when `ag` suggests the `-Q` option, and adds it.
2016-10-03 00:33:40 -04:00
Joseph Frazier
2b88ea11ea Suggest git diff --no-index when relevant
This makes it easier to use `git diff` on untracked files.
2016-10-03 00:05:01 -04:00
Vladimir Iakovlev
db7dffdb44 Merge pull request #559 from josephfrazier/git-push-explicit-upstream
Fix suggestions for `git push -u origin`
2016-10-02 17:21:53 +02:00
Vladimir Iakovlev
92f3c8fb52 Merge pull request #557 from OJFord/patch-1
Add sudo rule for Aura
2016-10-02 17:21:04 +02:00
Vladimir Iakovlev
7c4f0d2e55 Merge pull request #551 from scorphus/git-bisect-usage
#N/A: Add `git_bisect_usage` rule
2016-10-02 17:20:43 +02:00
Vladimir Iakovlev
d05eb0a6dc #552: Fix code style 2016-10-02 17:19:33 +02:00
Vladimir Iakovlev
cf352fd788 Merge branch 'remove-trailing-cedilla' of https://github.com/wikiti/thefuck into wikiti-remove-trailing-cedilla 2016-10-02 17:18:24 +02:00
Vladimir Iakovlev
3c1cce6bd2 Merge branch 'brew-link' of https://github.com/josephfrazier/thefuck into josephfrazier-brew-link
# Conflicts:
#	README.md
2016-10-02 17:17:15 +02:00
Vladimir Iakovlev
5d3a727d1a Merge pull request #555 from josephfrazier/brew-uninstall-force
Suggest `brew uninstall --force` when relevant
2016-10-02 17:14:54 +02:00
Vladimir Iakovlev
ea87d55771 Merge pull request #554 from JordonPhillips/aws-rule
Add new aws cli rule
2016-10-02 17:14:14 +02:00
Joseph Frazier
aa6b18d0ce Fix suggestions for git push -u origin
Resolves https://github.com/nvbn/thefuck/issues/558
2016-09-30 16:13:50 -04:00
Joseph Frazier
934eeaf4fc Test that git push -u origin still works
This was broken by https://github.com/nvbn/thefuck/pull/538
2016-09-30 16:11:46 -04:00
Ollie Ford
3ad8d52a84 Add sudo rule for Aura
When installing from Arch User Repository without root:
    aura >>= You have to use `sudo` for that.

This commit adds the slightly more general, but unambiguous, "use `sudo`".

This commit closes #543.
2016-09-30 20:32:40 +01:00
Joseph Frazier
bb5c7c576f Suggest brew link --overwrite --dry-run when relevant
This makes it easier to see which files would be overwritten by
`brew link --overwrite`
2016-09-30 15:31:25 -04:00
Joseph Frazier
17c3935078 Test brew uninstall --force suggestion 2016-09-29 17:44:07 -04:00
Joseph Frazier
a734b94fec Suggest brew uninstall --force when relevant
Resolves https://github.com/nvbn/thefuck/issues/553
2016-09-29 17:26:20 -04:00
JordonPhillips
7bf405e9c3 Add aws cli rule
This rule corrects spelling mistakes for aws cli commands and
subcommands.
2016-09-29 14:22:08 -07:00
Daniel Herzog
c3bcdd7dee Update README 2016-09-29 21:43:02 +01:00
Daniel Herzog
ad53023860 Fix encoding for Python 2.7 2016-09-29 21:41:50 +01:00
Daniel
8938323229 Fix encoding 2016-09-29 11:06:56 +01:00
Daniel
92133f77d6 Add test file 2016-09-29 10:44:17 +01:00
Daniel
64eaf96eb8 Add rule 2016-09-29 10:34:41 +01:00
Pablo Santiago Blum de Aguiar
c9264aff10 #N/A: Add git_bisect_usage rule 2016-09-27 19:42:01 -03:00
Vladimir Iakovlev
9660ec7813 Merge branch 'juzim-git-pull-uncommitted-changes' 2016-09-20 00:28:51 +02:00
Vladimir Iakovlev
9ac47d8f78 #550: Use shell.and_ 2016-09-20 00:28:09 +02:00
Julian Zimmermann
6e2b82911f Removed linebreak 2016-09-19 13:07:48 +02:00
Julian Zimmermann
af9d34c299 Added rule that stashes changed files before pulling and pops them afterwards. 2016-09-19 12:52:23 +02:00
Vladimir Iakovlev
bcc11219e6 Merge pull request #545 from waldyrious/patch-1
readme: add -H flag to second sudo pip command
2016-09-06 22:38:17 +02:00
Waldir Pimenta
495a66088b readme: add -H flag to second sudo pip command 2016-09-06 17:01:09 +01:00
Vladimir Iakovlev
4fe64e3dfa #N/A: Match git_add only if pathspec exists 2016-08-23 13:03:49 +03:00
Vladimir Iakovlev
cae76eb55f Merge branch 'kthrift-fix/prevent-cwd-tilde-dir-creation' 2016-08-22 05:45:41 +03:00
Vladimir Iakovlev
afd2ed4e51 #540: Fix code style, add test 2016-08-22 05:45:27 +03:00
Vladimir Iakovlev
1a4d74d487 Merge branch 'fix/prevent-cwd-tilde-dir-creation' of https://github.com/kthrift/thefuck into kthrift-fix/prevent-cwd-tilde-dir-creation 2016-08-22 05:20:29 +03:00
Kyle Thrift
0bd3e85e08 fix: new config dirs created in $HOME/.config/thefuck instead of $CWD
fix: use correct path in warning message when XDG_CONFIG_HOME defined
2016-08-21 15:59:16 -04:00
Vladimir Iakovlev
faeeef7666 Merge pull request #539 from blahgeek/master
prevent infinity loop while detecting shell
2016-08-21 15:22:36 +08:00
Vladimir Iakovlev
4d65d6a1df Merge pull request #538 from lukechilds/git-push-with-args
Preserve args for git_push
2016-08-21 15:20:54 +08:00
BlahGeek
cfa51506fb prevent infinity loop while detecting shell
In OS X, Process(pid=0).parent() == Process(pid=0)
2016-08-20 12:00:03 +08:00
Luke Childs
5df350254e Check arguments are preserved in git_push 2016-08-19 22:29:43 +01:00
Luke Childs
612c393ec4 Check git_push matches without specifying a branch 2016-08-19 22:19:09 +01:00
Luke Childs
4d89b3499e Preserve args for git_push 2016-08-19 22:08:30 +01:00
Vladimir Iakovlev
070bb2ff28 #N/A: Show deprecation warning when ~/.thefuck used 2016-08-14 20:02:33 +03:00
Vladimir Iakovlev
71025dff17 #N/A: Monkeypatch old pathlib even on unix 2016-08-14 15:32:53 +03:00
Vladimir Iakovlev
621b455334 #N/A: Monkeypatch pathlib on windows 2016-08-14 15:15:03 +03:00
Vladimir Iakovlev
176924c18d #N/A: Move imports from pathlib/pathlib2 to utils 2016-08-14 15:01:00 +03:00
Vladimir Iakovlev
1f75fc1ea9 #N/A: Remove deprecated thefuck-alias entry point 2016-08-14 14:43:13 +03:00
Vladimir Iakovlev
46cb87615e #N/A: Remove old-style rules support 2016-08-14 14:37:32 +03:00
Vladimir Iakovlev
c63e0d1582 Bump to 3.11 2016-08-14 13:18:43 +03:00
Vladimir Iakovlev
a3eb124033 #N/A: Disable port_already_in_use on systems without lsof 2016-08-14 08:39:26 +03:00
Vladimir Iakovlev
a1f115eb19 N/A: Add osx to travis-ci config 2016-08-14 08:18:02 +03:00
Vladimir Iakovlev
56851e8d31 #N/A: Add port_already_in_use rule 2016-08-14 06:59:26 +03:00
Vladimir Iakovlev
a8c3c2d728 #N/A: Fix tests on python 2 2016-08-13 21:46:12 +03:00
Vladimir Iakovlev
844d3af8ae #N/A: Add grunt_task_not_found rule 2016-08-13 21:13:05 +03:00
Vladimir Iakovlev
a2693bd737 #N/A: Add workon_doesnt_exists rule 2016-08-13 20:55:00 +03:00
Vladimir Iakovlev
ae3e231a5f #N/A: Add gradle_no_task rule 2016-08-13 20:31:33 +03:00
Vladimir Iakovlev
21bb439d7c #N/A: Add gradle_wrapper rule 2016-08-13 19:30:46 +03:00
Vladimir Iakovlev
efcf7da7db #N/A: Add react_native_command_unrecognized rule 2016-08-13 19:14:55 +03:00
Vladimir Iakovlev
5f79217e97 #N/A: Add slow_commands and wait_slow_command settings options 2016-08-13 18:55:11 +03:00
Vladimir Iakovlev
fdfbfc80c0 #N/A: Add npm_missing_script rule 2016-08-13 18:28:45 +03:00
Vladimir Iakovlev
b09a4e394e #N/A: Add npm_run_script rule 2016-08-13 17:38:40 +03:00
Vladimir Iakovlev
34973fe97e #N/A: Fix tests without CommandNotFound 2016-08-13 17:33:16 +03:00
Vladimir Iakovlev
379d2953c9 #N/A: Use for_app helper 2016-08-13 16:14:05 +03:00
Vladimir Iakovlev
065b350ada #N/A: Add fab_command_not_found rule 2016-08-13 16:10:12 +03:00
Vladimir Iakovlev
ca787a1cba #N/A: Ensure that command doesn't exists in no_command rule 2016-08-13 15:39:42 +03:00
Vladimir Iakovlev
4c2fc490f2 Merge branch 'master' of github.com:nvbn/thefuck 2016-08-13 15:33:12 +03:00
Vladimir Iakovlev
0c2083485d #N/A: Make apt-get rule more accurate, remove unstable tests 2016-08-13 15:30:57 +03:00
Vladimir Iakovlev
bc78c83224 Merge pull request #535 from scorphus/534-improve-open
#534: Improve open rule
2016-08-13 20:20:12 +08:00
Vladimir Iakovlev
b2a5009116 #N/A: Ensure that thefuck successfully installed in functional tests 2016-08-13 14:50:21 +03:00
Vladimir Iakovlev
087584a1e0 #N/A: Remove ability to run functional tests without docker 2016-08-13 14:11:18 +03:00
Pablo Santiago Blum de Aguiar
b6b15bf0d1 #534: Improve open rule by creating the file or dir 2016-08-12 01:09:05 -03:00
Pablo Santiago Blum de Aguiar
a169575b0f #534: Move “is arg a url?” logic to a function
This function will be used in `get_new_command`.
2016-08-12 00:53:11 -03:00
Pablo Santiago Blum de Aguiar
fbea803a9b #534: Use a stderr fixture on open rule tests 2016-08-12 00:20:12 -03:00
Vladimir Iakovlev
51415a5cb1 Merge pull request #530 from scorphus/git-branch-exists-checkout
#N/A: Use git_branch_exists rule with `checkout` too
2016-07-22 13:11:05 +03:00
Pablo Santiago Blum de Aguiar
237bc57999 #N/A: Use git_branch_exists rule with checkout too 2016-07-21 13:59:41 -03:00
nvbn
2af65071d8 Merge branch 'yeahbert-git_push_contains_work' 2016-07-07 15:42:02 +03:00
nvbn
c93b547624 #529: Minor style changes 2016-07-07 15:41:51 +03:00
Julian Zimmermann
837ca73f50 Added "contains work" error for git push 2016-07-07 11:47:51 +02:00
Vladimir Iakovlev
a3b2e6872b Merge pull request #527 from josephfrazier/brew-update
Add `brew update` to Homebrew commands
2016-06-30 01:46:36 +03:00
Joseph Frazier
29ed1800e1 Add brew update to Homebrew commands
`brew update` is implemented in shell instead of ruby, so
`_get_brew_commands` needs to list .sh files as well as .rb

Resolves https://github.com/nvbn/thefuck/issues/526
2016-06-29 15:50:01 -04:00
Vladimir Iakovlev
965c05bfdf Merge pull request #525 from tdsmith/patch-1
Avoid importing pip
2016-06-29 14:11:26 +03:00
Tim D. Smith
a7d1c725e4 Keep working if pip isn't installed
This might be installed by invoking setup.py directly.
2016-06-28 21:50:06 -07:00
Tim D. Smith
99e828d15d Avoid importing pip
pip doesn't have a stable Python API and shouldn't be `import`ed. `pkg_resources` is provided by setuptools.
2016-06-28 21:48:06 -07:00
nvbn
ae2b767a4d Merge branch 'scorphus-update-cargo-no-command' 2016-06-28 15:51:01 +03:00
nvbn
3893e0cdca #517: Little refactoring 2016-06-28 15:50:41 +03:00
nvbn
2988e4871f Merge branch 'update-cargo-no-command' of https://github.com/scorphus/thefuck into scorphus-update-cargo-no-command 2016-06-28 15:49:04 +03:00
nvbn
d5e333b727 Bump to 3.10 2016-06-28 03:30:27 +03:00
nvbn
1755bcd1b5 #524: Run functional tests only with python 3.5 2016-06-28 03:05:42 +03:00
nvbn
f773b57bea #511: Add ln_s_order rule 2016-06-28 03:00:00 +03:00
Vladimir Iakovlev
5866ea8433 Merge pull request #524 from nvbn/fix-func-tests-on-travis-ci
Fix functional tests on travis-ci
2016-06-28 00:38:58 +03:00
nvbn
729508e581 #524: Add commandnotfound to travis config 2016-06-28 00:38:38 +03:00
nvbn
1b7c8b5498 #524: Don't wait for prompt in zsh 2016-06-28 00:22:25 +03:00
nvbn
9b6cd0cd7b #524: Exit with 1 if no fixed command selected 2016-06-28 00:22:04 +03:00
nvbn
77ea630d84 #524: Remove skip_without_docker hacks 2016-06-28 00:11:56 +03:00
nvbn
917c6ac887 #524: Fix tcsh encoding 2016-06-28 00:00:49 +03:00
nvbn
8bea63eb23 #524: Remove unned dependencies from .travis.yml 2016-06-27 23:48:26 +03:00
nvbn
2bf21d9f0e #524: Wait for prompt in zsh tests 2016-06-27 23:48:06 +03:00
nvbn
e2f66cb26b #N/A: Enable docker service 2016-06-27 23:18:38 +03:00
Vladimir Iakovlev
ff1ee979f0 Merge pull request #518 from mklkj/master
Fix a typo
2016-06-27 23:15:41 +03:00
Vladimir Iakovlev
25343dbfb4 Merge pull request #523 from MattKotsenas/refactor/powershell-config
Add semi-colons in powershell alias
2016-06-27 23:15:14 +03:00
Vladimir Iakovlev
ea3671f98c Merge pull request #521 from b1101/master
ui: accept 'q' as quit character
2016-06-27 23:14:16 +03:00
nvbn
4584903beb #N/A: Temporary disable functional tests on travis-ci 2016-06-27 23:13:57 +03:00
nvbn
990ba57159 #N/A: Disable zsh test_with_confirmation without docker 2016-06-27 23:12:05 +03:00
Matt Kotsenas
16c110823d Add semi-colons in powershell alias
Add semi-colons in powershell alias so that if line breaks get lost the
function can still be invoked directly. This makes it possible to add
thefuck to the current session by running

    iex "$(thefuck --alias)"

which mirrors the eval syntax in bash
2016-06-27 13:29:24 -04:00
Romans Volosatovs
01418526b4 ui: accept 'q' as quit character
'q' is a standard character used in traditional UNIX environment
for 'quit', so it makes sense to support it in my opinion
2016-06-25 12:31:08 +02:00
mklkj
d2845a0d2e Fix a typo 2016-06-23 14:28:37 +02:00
Pablo Santiago Blum de Aguiar
2c1666abc4 #N/A: Update cargo_no_command rule to support current Cargo 2016-06-18 13:50:59 -03:00
nvbn
42853f41bb Merge branch 'TheJakeSchmidt-add-git_rebase_continue_no_changes' 2016-06-15 19:29:14 +04:00
nvbn
5f11ecc4f8 #515: Allow less strict check, use git_support 2016-06-15 19:28:58 +04:00
Jake
4bd4c0f731 Add a new rule git_rebase_no_changes. 2016-06-11 19:20:33 -04:00
Vladimir Iakovlev
b8c5433dc4 Merge pull request #513 from scorphus/cleanup_
#N/A: Cleanup shells/fish.py a bit
2016-06-06 06:46:36 +03:00
Pablo Santiago Blum de Aguiar
e2883430bc #N/A: Cleanup shells/fish.py a bit 2016-06-04 23:18:30 -03:00
Vladimir Iakovlev
a4b690369c Merge pull request #506 from asergi/pathlib2
Switch from pathlib to pathlib2
2016-05-17 02:23:03 +03:00
Vladimir Iakovlev
6bbd680e56 Merge pull request #507 from scorphus/assert-warns
#N/A: Assert deprecated warnings are raised
2016-05-17 02:22:34 +03:00
Pablo Santiago Blum de Aguiar
e5f8e9c0de #N/A: Assert deprecated warnings are raised 2016-05-15 17:04:09 -03:00
Alessio Sergi
ebf1ea88f5 Switch from pathlib to pathlib2
The pathlib backport module is no longer maintained. The development
has moved to the pathlib2 module instead.

Quoting from the pathlib's README:
"Attention: this backport module isn't maintained anymore. If you want
to report issues or contribute patches, please consider the pathlib2
project instead."
2016-05-12 17:17:17 +02:00
Vladimir Iakovlev
d2b0b6e8ec Merge pull request #505 from scorphus/decode-bin
#504: Decode binary name if on Python 2
2016-05-12 04:47:57 +03:00
Pablo Santiago Blum de Aguiar
561eb12c08 #504: UTF8-decode bin names if on Python 2
Fix #504
2016-05-11 13:31:57 -03:00
Pablo Santiago Blum de Aguiar
ed38fedf26 #504: Mock get_all_executables internals instead 2016-05-11 02:04:05 -03:00
nvbn
15bcd7f03f #501: Deprecate installation script 2016-05-09 18:54:40 +03:00
Vladimir Iakovlev
9e39bcd55c Merge pull request #503 from scorphus/readme-osx
#501: Split Ubuntu and OS X installation instructions
2016-05-09 15:14:05 +03:00
Pablo Santiago Blum de Aguiar
cfa73f10d6 #501: Split Ubuntu and OS X installation instructions 2016-05-03 22:54:22 -03:00
Vladimir Iakovlev
c3709682d5 Merge pull request #500 from scorphus/history-merge
#495: Alter history only when configured to do so
2016-05-03 13:18:12 +03:00
Pablo Santiago Blum de Aguiar
96f7e53aa2 #495: Alter history only when configured to do so 2016-04-30 18:39:08 -03:00
Pablo Santiago Blum de Aguiar
d1f55603fe #495: Merge history only when alter_history is set 2016-04-29 23:21:28 -03:00
nvbn
f74bbb7a9a Bump to 3.9 2016-04-24 17:56:06 +03:00
nvbn
d6c2c7266d Merge branch 'scorphus-fish-put-to-history' 2016-04-22 03:17:40 +03:00
nvbn
51839e65cd #495: Add comment in put_to_history 2016-04-22 03:16:16 +03:00
nvbn
d5ae3a6b41 Merge branch 'fish-put-to-history' of https://github.com/scorphus/thefuck into scorphus-fish-put-to-history
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2016-04-22 03:14:31 +03:00
Vladimir Iakovlev
9f421a17e5 Merge pull request #494 from scorphus/brew-update-formula
#N/A Add a new rule `brew_update_formula`
2016-04-21 13:06:11 +03:00
Pablo Santiago Blum de Aguiar
9d9820676a #N/A Add a new rule brew_update_formula 2016-04-20 22:27:39 -03:00
nvbn
5ec4909d2f #N/A: Minor style changes 2016-04-12 00:37:18 +03:00
nvbn
c6d2766553 #N/A: Add chmod +x rule 2016-04-11 16:13:41 +03:00
nvbn
c6af8409d9 Bump to 3.8 2016-04-08 14:36:53 +03:00
Vladimir Iakovlev
95e7d00aec Merge pull request #492 from scorphus/overridden-aliases
Treat overridden aliases in a better way
2016-04-07 13:09:08 +03:00
Pablo Santiago Blum de Aguiar
cdccf1881e #253: Use a better name for that env var 2016-04-06 23:11:19 -03:00
Pablo Santiago Blum de Aguiar
db6053b301 #253: Update default overridden aliases with user's 2016-04-06 22:58:08 -03:00
nvbn
183b70c8b8 Merge branch 'scorphus-git-branch-exists' 2016-04-03 14:08:26 +03:00
nvbn
5e0cc8c703 #491: yield possible fixes in git_branch_exists rule 2016-04-03 14:07:39 +03:00
nvbn
1aa2ec1795 Merge branch 'git-branch-exists' of https://github.com/scorphus/thefuck into scorphus-git-branch-exists 2016-04-03 14:02:32 +03:00
Pablo Santiago Blum de Aguiar
0c98053f74 #N/A Add a new rule git_branch_exists 2016-04-03 00:09:15 -03:00
Vladimir Iakovlev
17b2fba48d Merge pull request #489 from scorphus/improve-readme
Improve readme
2016-04-02 01:44:51 +03:00
Pablo Santiago Blum de Aguiar
43886c38ff #N/A Add more fancy badges 2016-03-31 22:07:10 -03:00
Pablo Santiago Blum de Aguiar
9070748a86 #N/A Use reference links 2016-03-31 22:06:01 -03:00
Pablo Santiago Blum de Aguiar
61de6f4a51 #N/A Reformat parts of README.md 2016-03-31 15:53:32 -03:00
Vladimir Iakovlev
d102af41d9 #488 Add AppVeyor badge 2016-03-31 04:50:40 +03:00
Vladimir Iakovlev
b7002bb9f9 Merge pull request #488 from scorphus/app-veyor
App veyor
2016-03-31 04:44:44 +03:00
Pablo Santiago Blum de Aguiar
18b4f5df6a #486: Run tests on AppVeyor 2016-03-29 23:39:53 -03:00
Pablo Santiago Blum de Aguiar
28153db4a8 #486: Ignore a test on Windows 2016-03-29 23:39:53 -03:00
Pablo Santiago Blum de Aguiar
047a1a6072 #486: Use Path instead of PosixPath 2016-03-29 23:39:53 -03:00
Pablo Santiago Blum de Aguiar
69db5c70e6 #486: Fix path joining on Windows 2016-03-29 23:39:45 -03:00
nvbn
fa1edd4bae Bump to 3.7 2016-03-23 05:12:29 +02:00
Vladimir Iakovlev
333c4b2a3f Merge pull request #483 from shakaran/patch-1
Update install procedure for pip
2016-03-23 05:11:07 +02:00
Vladimir Iakovlev
b1f10642fa Merge pull request #487 from scorphus/stdout-encoding-none
#486: Use alternative encoding when sys.stdout.encoding is None
2016-03-23 05:09:36 +02:00
Pablo Santiago Blum de Aguiar
047efd5575 #486: Use alternative encoding when sys.stdout.encoding is None
Fix #486
2016-03-22 16:13:59 -03:00
Vladimir Iakovlev
f604756cb7 Merge pull request #485 from scorphus/484-stdin-pipe
#484: Use PIPE as stdin when Popening the script
2016-03-21 22:35:18 +02:00
Pablo Santiago Blum de Aguiar
a27115bff1 #484: Use PIPE as stdin when Popening the script
Fix #484
2016-03-21 16:59:35 -03:00
Ángel Guzmán Maeso
5d00b3bc25 Update install procedure for pip
Avoid the warning:

The directory '/home/someuser/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
2016-03-21 17:48:41 +01:00
Vladimir Iakovlev
0cf4f5e8b0 Merge pull request #481 from scorphus/fix-git-add
Fix `git_add` rule
2016-03-19 12:59:22 +02:00
Pablo Santiago Blum de Aguiar
41707b80c6 #N/A: Fix git_add rule 2016-03-18 22:46:38 -03:00
Vladimir Iakovlev
3a39deb485 Merge pull request #478 from MattKotsenas/feature/powershell-shell
Add Powershell as shell
2016-03-19 02:45:26 +02:00
Matt Kotsenas
d4bc8cebf1 Replace raise with return for Ctrl+C in Windows
- Replace the raise `const.CtrlC` with `return const.CtrlC` the match the
  unix implementation and prevent a stacktrace when cancelling a command
  on Windows
2016-03-16 16:37:59 -07:00
Matt Kotsenas
6daf687237 Add Powershell as a supported shell
- There may be additional functionality to implement, but I've been
  running this way for a month with no known issues
2016-03-16 16:06:09 -07:00
Matt Kotsenas
2207dd2668 Update _get_shell to work with Windows
- _get_shell assumed the parent process would always be the shell process, in Powershell the
  parent process is Python, with the grandparent being the shell
- Switched to walking the process tree so the same code path can be used in both places
2016-03-15 14:10:04 -07:00
Vladimir Iakovlev
d1ab08a797 Merge pull request #477 from scorphus/git-rm-recursive
#N/A: Add new `git_rm_recursive` rule
2016-03-15 04:30:31 +03:00
Pablo Santiago Blum de Aguiar
51e89a36ef #N/A: Add new git_rm_recursive rule 2016-03-14 18:59:32 -03:00
nvbn
39f7cc37eb Bump to 3.6 2016-03-13 17:46:14 +03:00
nvbn
251b69b5a0 #475: Try to use already used executable in no_command 2016-03-13 15:10:37 +03:00
nvbn
8b1f078e27 Bump to 3.5 2016-03-13 03:14:18 +03:00
Vladimir Iakovlev
a47e84fa6b Merge pull request #476 from scorphus/git-help-aliased
#N/A: Add new `git_help_aliased` rule
2016-03-13 01:24:57 +03:00
Pablo Santiago Blum de Aguiar
bcab700215 #N/A: Add new git_help_aliased rule 2016-03-12 18:51:47 -03:00
Vladimir Iakovlev
4fb99fd7a8 Merge pull request #474 from scorphus/alias-variables
#301: Set variables within the alias
2016-03-10 13:25:50 +03:00
Pablo Santiago Blum de Aguiar
bb5f6bb705 #301: Set variables within the alias
Fix #301
2016-03-09 21:58:18 -03:00
Vladimir Iakovlev
d92765d5df Merge pull request #473 from scorphus/gdbm-unavailable
#439 & #447: Remove cache if created with unavailable db
2016-03-10 02:52:33 +03:00
Pablo Santiago Blum de Aguiar
d8de5cfd20 #439 & #447: Remove cache if created with unavailable db
When switching between Python versions, the database package used to
create the cache might be unavailable and an ImportError is raised,
such as `ImportError: No module named gdbm`.
2016-03-08 14:38:16 -03:00
Vladimir Iakovlev
d73b14ce4b Merge pull request #472 from PLNech/master
Rules: git remote add instead of set-url if remote does not exist
2016-03-06 13:33:14 +03:00
Paul-Louis NECH
04b83cf7e8 Rules: git remote add instead of set-url if remote does not exist
Tests: Added test for git_remote_seturl_add

Rules: renamed new rule with a more appropriate name

README: added new rule

Style: Formatting

New rule: corrected test name

Developed tests
2016-03-04 22:35:55 +01:00
nvbn
019f0abf67 Bump to 3.4 2016-03-04 00:21:51 +03:00
nvbn
c8d3dcd1bf Merge branch 'lawrencebenson-master' 2016-03-04 00:20:43 +03:00
nvbn
4f5b382df4 #471: Use parametrized tests 2016-03-04 00:20:33 +03:00
lawrencebenson
77ad68b04b Fix encoding error in source file example 2016-03-03 10:43:33 +01:00
lawrencebenson
6b0311181d Fix encoding error for Python 2 2016-03-02 23:19:22 +01:00
lawrencebenson
48808f93ac Add no hard link support for ln 2016-03-02 17:57:53 +01:00
nvbn
7ce4307c87 #402: Don't invoke bash for getting aliases 2016-03-01 01:28:21 +03:00
nvbn
f7f0660114 #402: Don't invoke zsh for getting aliases 2016-03-01 01:21:51 +03:00
nvbn
46f2351907 #N/A: zsh history doesn't update on travis-ci without manual fc -r call 2016-02-22 18:47:15 +03:00
nvbn
e9de01fa41 #N/A: Move all consts to const 2016-02-22 18:40:28 +03:00
nvbn
9b260eb239 ⚠️ #442: Change history only on shell side 2016-02-22 18:31:28 +03:00
Vladimir Iakovlev
f20d4dbf85 Merge pull request #465 from mcarton/histfile2
Let bash handle bash’s history
2016-02-22 17:31:59 +03:00
mcarton
4af7dc2748 Let bash handle bash’s history 2016-02-22 14:53:53 +01:00
Vladimir Iakovlev
c8e9606c7d Merge pull request #462 from scorphus/fish-alias
#N/A Remove fucked up cmd from history regardless of status
2016-02-22 15:48:06 +03:00
Pablo Santiago Blum de Aguiar
d71b9c2e62 #N/A Remove fucked up cmd from history regardless of status
Most fucked up commands are erroneous, but that's not always the case.
2016-02-18 15:17:46 -02:00
Vladimir Iakovlev
60497b9d04 Merge pull request #461 from mcarton/ruby-gem
Add ruby gem error message to sudo patterns
2016-02-18 12:21:54 +03:00
mcarton
619af2638a Make sudo patterns lowercase 2016-02-16 22:27:01 +01:00
mcarton
a1f15bfe5f Add ruby gem error message to sudo patterns 2016-02-16 22:26:22 +01:00
Vladimir Iakovlev
ce959b2a8b Merge pull request #458 from scorphus/anydbm
#439 #447 Except anydbm instead of gdbm for PY2
2016-02-15 14:21:37 +03:00
Pablo Santiago Blum de Aguiar
3cc4940842 #439 #447 Except anydbm instead of gdbm for PY2
Fix #439 and close #447
2016-02-14 00:43:07 -02:00
nvbn
470c0ef699 #444: Check pip version in setup.py 2016-02-12 20:11:08 +03:00
nvbn
4f95b3365a #N/A: Add grep_arguments_order rule 2016-02-08 11:04:19 +03:00
nvbn
bbfd53d718 #N/A: Use shutil.which when possible 2016-02-06 16:42:42 +03:00
nvbn
28d078708b #N/A: Check that brew/apt available in related rules 2016-02-06 16:37:11 +03:00
nvbn
778d5f3e6e #N/A: Add npm_wrong_command rule 2016-02-06 15:18:44 +03:00
Vladimir Iakovlev
c5acee54ea Merge pull request #452 from scorphus/increase-coverage
Increase coverage
2016-02-01 17:52:08 +03:00
Pablo Santiago Blum de Aguiar
c3e9c1bfc1 #N/A Completely test rules.apt_get 2016-01-31 19:55:45 -02:00
Pablo Santiago Blum de Aguiar
6c25b33b9e #N/A Add parameter and skip a test for apt_get rule 2016-01-31 19:55:45 -02:00
Pablo Santiago Blum de Aguiar
052f415d94 #N/A Completely test rules.gulp_not_task 2016-01-31 19:55:44 -02:00
Pablo Santiago Blum de Aguiar
3438d6dde7 #N/A Completely test rules.git_checkout 2016-01-31 19:55:44 -02:00
Vladimir Iakovlev
af0fe66a9f Merge pull request #441 from nvbn/simplify-shells
Split `shells` module
2016-01-31 00:04:35 +03:00
nvbn
fe07fcaa62 #441: Remove shells methods wrappers 2016-01-29 13:09:40 +03:00
nvbn
b5dc7aab6d #441: Remove all logic from shells methods wrappers 2016-01-29 12:30:31 +03:00
nvbn
a2ec5aa3ff #441: Move function for getting current alias to utils 2016-01-29 12:22:31 +03:00
nvbn
0b2bda9e85 Merge branch 'master' into simplify-shells 2016-01-29 12:15:05 +03:00
nvbn
68c882cf1a Merge branch 'fix-fish-how-to' of https://github.com/scorphus/thefuck into scorphus-fix-fish-how-to 2016-01-29 12:07:27 +03:00
nvbn
abe8fb84c6 Merge branch 'master' of github.com:nvbn/thefuck 2016-01-29 12:04:07 +03:00
nvbn
86b17eb570 Fix travis builds 2016-01-29 12:03:47 +03:00
Pablo Santiago Blum de Aguiar
dcc0ce7ff3 #449 Fix Fish.how_to_configure()
Fix #449
2016-01-28 20:47:17 -02:00
Vladimir Iakovlev
fee874cddc Merge pull request #443 from aureooms/patch-1
new pattern in sudo rule
2016-01-24 16:45:17 +03:00
Aurélien Ooms
2ce1c6bf90 new pattern in sudo rule
`pacman-key --refresh-keys` outputs the following when not run as root

```
==> ERROR: pacman-key needs to be run as root for this operation.
```
2016-01-24 14:38:13 +01:00
nvbn
9b129fad08 #N/A: Add docsting in shells 2016-01-24 04:39:27 +03:00
nvbn
20adefbe7d Merge branch 'master' into simplify-shells 2016-01-23 23:49:26 +03:00
nvbn
52ef1fa47d #438: Replace [[ with [ in install script 2016-01-23 23:48:51 +03:00
nvbn
94f8652175 #N/A: Add tests for tcsh 2016-01-23 05:06:33 +03:00
nvbn
abe287a52b #N/A: Split shells module 2016-01-23 05:06:22 +03:00
nvbn
60e19a054a #N/A: Replace PY3 checks with PY2 checks 2016-01-22 17:02:08 +03:00
Vladimir Iakovlev
45add1e3d6 Merge pull request #437 from BuBuaBu/master
Exclude recursively tests packages
2016-01-22 16:56:29 +03:00
Vladimir Iakovlev
934870f650 Merge pull request #436 from scorphus/shelve-open-errors
Fix cache problem when going from Python 3 to 2
2016-01-22 16:56:08 +03:00
BuBuaBu
738cc0c9a8 Exclude recursively tests packages 2016-01-22 13:47:31 +01:00
Pablo Santiago Blum de Aguiar
cb6f964a30 Fix cache problem when going from Python 3 to 2 2016-01-21 23:57:17 -02:00
Vladimir Iakovlev
9c9a7343de Merge pull request #435 from scorphus/cache-fish-aliases
#353 Cache Fish aliases too
2016-01-21 18:40:11 +03:00
Pablo Santiago Blum de Aguiar
3803452980 #353 Cache Fish aliases too 2016-01-20 21:43:00 -02:00
Vladimir Iakovlev
a19833d0c7 Merge pull request #434 from scorphus/433-ioencoding
#433: Set env vars right in the aliases
2016-01-17 14:00:23 +03:00
Pablo Santiago Blum de Aguiar
084b907ac0 #433: Set env vars right in the aliases
Fix #433
2016-01-16 21:35:15 -02:00
nvbn
bd5cf38271 Bump to 3.3 2016-01-13 22:33:04 +03:00
Vladimir Iakovlev
3c3d17e0ea Merge pull request #432 from nvbn/422-not-alter-history
#422: Add `alter_history` settings option
2016-01-13 22:31:19 +03:00
nvbn
2f353498de #422: Add alter_history settings option 2016-01-13 22:22:51 +03:00
Vladimir Iakovlev
f0f49c1865 Merge pull request #430 from nvbn/429-apt-invalid-operation
#429: Add `apt_invalid_operation` rule
2016-01-13 22:12:35 +03:00
nvbn
20fff3142c #429: Fix tests with python 2 2016-01-13 22:08:24 +03:00
Vladimir Iakovlev
6e22b9ec6c Merge pull request #431 from nvbn/428-readonly-history
#428: Don't fail when history is readonly
2016-01-13 22:03:31 +03:00
nvbn
d53240b777 #428: Don't fail when history is readonly 2016-01-13 22:00:20 +03:00
nvbn
cab933e7e6 #429: Add apt_invalid_operation rule 2016-01-13 21:53:11 +03:00
Vladimir Iakovlev
8b05f6d46f Merge pull request #427 from makalaaneesh/master
#425 command had to be re escaped
2016-01-08 16:38:05 +03:00
Vladimir Iakovlev
ec64fbd5ea Merge pull request #426 from web-connect/patch-1
Fixing typos
2016-01-08 16:37:23 +03:00
makalaaneesh
4f9fb796c4 fixes #425. command had to be re escaped 2016-01-08 00:50:26 +05:30
Justin Turner
be744f20ba Fixing typos 2016-01-07 09:36:37 -06:00
Vladimir Iakovlev
1b12cd85e9 Merge pull request #423 from MattKotsenas/bugfix/cd_mkdir
Add Windows error message support to cd_mkdir rule
2016-01-06 03:34:03 +03:00
Matt Kotsenas
47df80f6b8 Add Windows error message support to cd_mkdir rule
Add the Windows error message 'the system cannot find the path specified'
to the list of recognized messages for cd_mkdir.
2016-01-05 13:55:59 -08:00
Vladimir Iakovlev
a0ef0efe46 Merge pull request #419 from mcarton/fix-unzip
Fix the `dirty_unzip` rule
2015-12-30 00:58:30 +03:00
Vladimir Iakovlev
25662ad737 Merge pull request #418 from makalaaneesh/master
sudo sh execute for && in commands - preventing double sudo
2015-12-30 00:57:50 +03:00
mcarton
42b344676e Fix dirty_unzip rule on non-zip files 2015-12-29 18:46:35 +01:00
mcarton
a3e1cb6718 Fix thefuck unzip, fix #416 2015-12-29 18:38:58 +01:00
makalaaneesh
f249098336 sudo sh execute for && in commands - preventing double sudo 2015-12-23 14:35:47 +05:30
nvbn
c3b1ba7637 #415: Prevent double sudo 2015-12-11 07:41:13 +08:00
nvbn
b65a9a0a4f #414: Initialize output before any colorama import 2015-12-04 18:34:52 +08:00
nvbn
29c1d1efcf #414: Move system-dependent utils in system module 2015-12-03 20:03:27 +08:00
nvbn
0560f4ba8e #414: Install and use win_unicode_console only on windows 2015-12-01 20:15:27 +08:00
Pavel Krymets
f9aa0e7c6b Fix windows unicode output issues 2015-11-30 16:24:31 -08:00
Pavel Krymets
b18a049886 Fix getch on windows 2015-11-30 12:33:28 -08:00
nvbn
9192b555b5 Merge branch 'master' of github.com:nvbn/thefuck 2015-11-26 03:42:16 +08:00
nvbn
d750d3d6d1 #412: Add _script_from_history for generic shell 2015-11-26 03:42:03 +08:00
Vladimir Iakovlev
3ad953001d Merge pull request #411 from scorphus/unicode
Support non-ascii content in Python 2
2015-11-25 20:41:20 +08:00
Pablo Santiago Blum de Aguiar
3b4b87d8ed #398: Test PYTHONIOENCODING=utf-8 in shell aliases 2015-11-25 02:34:33 -02:00
Pablo Santiago Blum de Aguiar
6c3d67763a #398: Add PYTHONIOENCODING=utf-8 to Fish Shell alias 2015-11-25 02:34:33 -02:00
Pablo Santiago Blum de Aguiar
959680d24d #N/A Set TF_ALIAS as an environment variable
For more info, check:

http://fishshell.com/docs/current/faq.html#faq-single-env
2015-11-25 02:34:33 -02:00
Pablo Santiago Blum de Aguiar
b0adc7f2ca #N/A Indent Fish alias with two spaces (default) 2015-11-25 02:34:33 -02:00
Pablo Santiago Blum de Aguiar
fc05364233 #398 & #408: Support non-ascii IO in Python 2 2015-11-25 02:34:19 -02:00
Pablo Santiago Blum de Aguiar
ad3db4ac67 #N/A Fix F812 list comprehension redefines cmd 2015-11-25 02:34:15 -02:00
Pablo Santiago Blum de Aguiar
4a7b335d7c #N/A Add ability to get Fish Shell history 2015-11-25 02:34:02 -02:00
Pablo Santiago Blum de Aguiar
465f6191b0 #N/A Cleanup and adjust syntax 2015-11-25 01:58:07 -02:00
Vladimir Iakovlev
b2836319ad Update README.md 2015-11-19 11:22:56 +08:00
Vladimir Iakovlev
b3e9b36bd1 Merge pull request #409 from nvbn/394-history-limit
#394 history limit
2015-11-19 11:17:21 +08:00
lovedboy
ae2949cfa2 python2.7 unicode error 2015-11-19 09:40:44 +08:00
nvbn
1bb04b41eb #398: Add PYTHONIOENCODING=utf-8 to shell aliases 2015-11-18 18:37:11 +08:00
Vladimir Iakovlev
acd0b3e024 Merge pull request #406 from mcarton/py2→3
Fix cache problem when going from Python 2 to 3
2015-11-18 18:32:24 +08:00
mcarton
7c5676491a Fix some more warnings from flake8 2015-11-15 18:08:59 +01:00
mcarton
8feb722ed0 Fix some pep8 warnings 2015-11-15 18:02:37 +01:00
mcarton
c3ea2fd0c7 Fix cache problem when going from Python 2 to 3 2015-11-15 16:55:07 +01:00
nvbn
b55464b2ea #403 Add sudo rule's pattern for dscl 2015-11-13 15:37:13 +08:00
nvbn
8ddb61ae89 #N/A Add python-gdbm to install script 2015-11-12 18:43:15 +08:00
Vladimir Iakovlev
fe91008a9c Merge pull request #400 from alessio/fix-memoize
Fix misinterpretation of the disabled flag
2015-11-06 02:19:07 +08:00
Alessio Treglia
7f777213c5 Fix misinterpretation of the disabled flag
The old implementation was misinterpretating the disabled flag and
effectively applying memoization even when explicitly disabled.
The 'or' operator is a short-circuit one; namely, it evaluates the
second argument if and only if the first is False. Therefore the
following conditions caused unexpected side effects:

- memoize.disabled = True, key not yet memoized

  Having disabled the memoize function wrapper, the client expects
  that no memoization happens. Instead the execution enters the
  if clause and store the value into the 'memo' dictionary

- memoize.disabled = True, key memoized

  Having disabled the memoize function wrapper, the client expects
  that no memoization happens and the function will be evaluated
  anyway, whether or not its return value had already been stored in
  the 'memo' dictionary by a previous call. On the contrary, the last
  statement of wrapper() access the value stored by the last function
  execution.

This commit attempts to improve the function readability too.
2015-11-04 22:44:50 +00:00
nvbn
89f868c115 Bump to 3.2 2015-11-03 17:38:07 +08:00
nvbn
81f6a25abc #398: Fix UnicodeDecodeError in logs 2015-11-01 14:42:48 +08:00
nvbn
cc9af78787 Merge branch 'master' of github.com:nvbn/thefuck 2015-11-01 13:17:15 +08:00
nvbn
1fc3f1b5bf #398: Fix UnicodeDecodeError in logs 2015-11-01 13:16:58 +08:00
Vladimir Iakovlev
45574d06c9 Merge pull request #397 from janek-warchol/use-force-with-lease
Use --force-with-lease instead of --force for git push
2015-10-31 02:47:51 +08:00
Jan Warchoł
dc23d67a42 Use --force-with-lease instead of --force for git push
--force flag can be very dangerous, because it unconditionally
overwrites remote branch - if someone pushed new commits to the remote
repo after you last fetched/pulled, and you do push --force, you will
overwrite his commits without even knowing that you did that.  Using
--force-with-lease is much safer because it only overwrites remote
branch when it points to the same commit that you think it points to.

Read more:
https://developer.atlassian.com/blog/2015/04/force-with-lease/
2015-10-30 16:17:56 +01:00
nvbn
2fea0d4c60 #394: Force history_limit to be int 2015-10-30 16:23:19 +08:00
nvbn
8c8abca8d5 #394: readlines isn't lazy 2015-10-29 22:51:30 +08:00
nvbn
bd6ee68c03 #394: Try simpler solution to limit lines count 2015-10-29 20:17:17 +08:00
nvbn
16533e85a7 Merge branch 'debug' of git://github.com/lovedboy/thefuck into lovedboy-debug 2015-10-29 20:00:04 +08:00
lovedboy
b3a19fe439 history limit from settings 2015-10-29 10:14:34 +08:00
nvbn
959b96cf6e #392: Show only debug message if script isn't splitable 2015-10-29 01:03:27 +08:00
nvbn
f20311fa89 #392: Little refactoring 2015-10-29 00:13:59 +08:00
nvbn
a4c391096a Merge branch 'fix-split' of https://github.com/mcarton/thefuck into mcarton-fix-split 2015-10-29 00:04:29 +08:00
mcarton
e71a3e0cdb Replace (almost) all instance of script.split 2015-10-28 16:43:24 +01:00
mcarton
2d995d464f Fix the cpp11 rule 2015-10-28 15:27:10 +01:00
mcarton
280751b36e Fix the unzip rules and filenames with spaces 2015-10-28 15:13:33 +01:00
mcarton
0a6a3db65d Fix the untar rules and filenames with spaces 2015-10-28 15:12:59 +01:00
mcarton
ecfc180280 Add shells.quote 2015-10-28 14:16:01 +01:00
mcarton
dae58211ba Parse command line with shlex
I put that in shells so that weird shells might try to parse it
differently.
2015-10-28 14:01:14 +01:00
Vladimir Iakovlev
5e9b2c56da Merge pull request #391 from mcarton/tox-3.5
#374 Test python 3.5 with tox
2015-10-28 20:52:45 +08:00
mcarton
192ab0bfb0 Test python 3.5 with tox 2015-10-28 13:32:37 +01:00
lovedboy
372e983459 add THEFUCK_HISTORY_LIMIT, my machine is so slow 2015-10-22 19:25:00 +08:00
nvbn
346cb99217 #385 Little refactoring 2015-10-21 18:13:22 +08:00
nvbn
bbfedb861f Merge branch 'xdg' of https://github.com/mcarton/thefuck into mcarton-xdg 2015-10-21 18:03:39 +08:00
nvbn
f5b0e96747 #382 Prevent partial execution of install.sh 2015-10-21 18:00:08 +08:00
Vladimir Iakovlev
12a33f56bc Merge pull request #389 from scorphus/fix-touch
Fix `rules.touch` tests
2015-10-21 17:50:09 +08:00
Pablo Santiago Blum de Aguiar
590fdba2aa Fix rules.touch tests
Move them to `rules` sub-directory and import `shells` instead of `and_`
which in turn triggers the `generic_shell` fixture fixing the tests on
Fish Shell.
2015-10-18 19:49:46 -02:00
Vladimir Iakovlev
f374142bf8 Merge pull request #384 from scorphus/fish-func
Improve the Fish Shell function making it faster
2015-10-19 01:50:53 +08:00
Vladimir Iakovlev
540ff7e16d Merge pull request #387 from scorphus/git-two-dashes
Add `git_two_dashes` rule
2015-10-19 01:50:04 +08:00
Vladimir Iakovlev
806dad18bf Merge pull request #386 from mcarton/CONTRIBUTING
Add a CONTRIBUTING file
2015-10-19 01:49:02 +08:00
Vladimir Iakovlev
8b416f269f Merge pull request #388 from scorphus/fix-brew-tests
Fix rules.brew_install tests on Mac
2015-10-19 01:48:53 +08:00
Pablo Santiago Blum de Aguiar
5e44fb22be Fix rules.brew_install tests on Mac 2015-10-17 18:46:07 -03:00
Pablo Santiago Blum de Aguiar
5389d0c106 Add git_two_dashes rule 2015-10-17 18:40:53 -03:00
mcarton
c970f190d2 Add a CONTRIBUTING file 2015-10-17 15:45:13 +02:00
mcarton
8f25c95f06 Use XDG_CACHE_HOME for cache 2015-10-16 17:33:52 +02:00
mcarton
4a48108c69 Follow the XDG Base Directory Specification 2015-10-16 16:52:03 +02:00
Pablo Santiago Blum de Aguiar
f5e8fe954e Improve the Fish Shell function making it faster
It works now with no temp file involved, which makes it a lot faster.
Also, `history --merge`, although only supported on Fish Shell 2.2+,
merges the corrected entry back into history. Neat!

Ref #89
2015-10-16 00:42:34 -03:00
nvbn
3da26192cb Bump to 3.1 2015-10-08 10:30:38 +08:00
Vladimir Iakovlev
11c133523a Merge pull request #375 from jab/patch-1
rm -f $eval_script
2015-10-03 10:24:39 +08:00
Vladimir Iakovlev
4b3e6a1448 Merge pull request #374 from mcarton/python3.5
Test on python 3.5
2015-10-03 10:23:41 +08:00
jab
09d9f63c98 use /bin/rm rather than rm -f 2015-10-02 10:12:50 -04:00
jab
e8883429c6 rm -f $eval_script
Without this change, users who have "rm" aliased to "rm -i"
have to confirm removal of the file after running fuck. This
change allows such users to run fuck without having to do
the superfluous rm confirmation.
2015-10-02 10:09:19 -04:00
nvbn
c1b67f2514 Show python version in --version 2015-09-28 16:47:54 +08:00
mcarton
3d6e7b17db Test on python 3.5 2015-09-15 02:17:56 +02:00
Vladimir Iakovlev
75ef866214 Merge pull request #373 from grammaright/master
Add j, k key for arrow action at read_actions
2015-09-13 12:38:55 +03:00
grammaright
5021d16cea Add j, k key for arrow action at read_actions 2015-09-13 01:27:21 +09:00
Vladimir Iakovlev
af259846b4 Merge pull request #370 from nvbn/369-git-fix-stash-fails
#369 Fix `git_fix_stash` fails when script is just `git`
2015-09-10 15:11:34 +03:00
nvbn
213791d3c2 #369 Fix git_fix_stash fails when script is just git 2015-09-10 14:28:22 +03:00
nvbn
71dc2666cc Bump to 3.0 2015-09-09 10:59:07 +03:00
Vladimir Iakovlev
3e66a294c4 Merge pull request #367 from nvbn/355-touch-rule
#355 Add `touch` rule
2015-09-09 10:57:55 +03:00
nvbn
3e8db28a73 #355 Add touch rule 2015-09-09 10:53:56 +03:00
Vladimir Iakovlev
6e886c6b4f Merge pull request #366 from nvbn/unned-abstractions
Improve code structure
2015-09-08 17:53:37 +03:00
nvbn
3fc2efee0f #366 Don't make bash history checks in travis-ci, it works incorrectly 2015-09-08 17:48:33 +03:00
nvbn
cb14aded6b #366 Remove sleep before checking history 2015-09-08 17:47:04 +03:00
nvbn
08af616e3d #366 Add sleep before checking history 2015-09-08 17:39:52 +03:00
nvbn
dfa22bc92b #366 Add type annotations in core components 2015-09-08 15:54:07 +03:00
nvbn
eb17e696c3 #366 Fix python 2 support 2015-09-08 15:32:19 +03:00
nvbn
b8ce95ad68 Minor refactoring 2015-09-08 15:24:49 +03:00
nvbn
1173f9f59c Organize settings initialization logic in Settings 2015-09-08 15:15:53 +03:00
nvbn
a8dbc48fd4 Move commands-related logic to Command and CorrectedCommand 2015-09-08 15:00:57 +03:00
nvbn
4a27595e97 Move rule-related code to Rule 2015-09-08 14:18:11 +03:00
nvbn
bf80d97062 Remove obscure SortedCorrectedCommandsSequence 2015-09-08 12:52:10 +03:00
nvbn
1fb6dd925b Remove on_change from CommandSelector 2015-09-08 12:27:17 +03:00
nvbn
b2be0b3cad Remove obscure RulesNamesList and DefaultRulesNames 2015-09-08 12:14:39 +03:00
Vladimir Iakovlev
122541b7d8 Merge pull request #365 from mcarton/fix-unzip
Fix #363
2015-09-07 23:36:13 +03:00
mcarton
488c1dad79 Merge branch 'master' of github.com:nvbn/thefuck into fix-unzip 2015-09-07 21:12:14 +02:00
mcarton
c3fe7e5e68 Fix #363 2015-09-07 20:48:10 +02:00
nvbn
3d56204f92 Update readme 2015-09-07 19:13:17 +03:00
Vladimir Iakovlev
293f16c3c8 Merge pull request #364 from nvbn/global-settings
Don't pass `settings` explicitly
2015-09-07 19:09:31 +03:00
nvbn
7339a97b90 #364 Make aliases cache persistent 2015-09-07 19:05:38 +03:00
nvbn
f3525e9fe0 #364 Attach user_dir to settings 2015-09-07 18:59:10 +03:00
nvbn
df4d2cc88d ⚠️ Remove settings param from rules match, get_new_command and side_effect 2015-09-07 13:00:29 +03:00
nvbn
382eb8b86c Fix tests 2015-09-07 12:12:16 +03:00
nvbn
105d3d8137 Make settings a global singleton 2015-09-06 21:47:12 +03:00
Vladimir Iakovlev
191a2e588d Merge pull request #362 from nvbn/356-fuck-endpoint
#356 fuck endpoint
2015-09-06 13:43:24 +03:00
nvbn
f964c65f16 #362 Fix tests for python 2 2015-09-06 13:40:29 +03:00
nvbn
dd0667ea8f #356 Ignore thefuck entry points 2015-09-06 13:37:48 +03:00
nvbn
4392872568 #356 Print useful information when fuck called and alias isn't configured 2015-09-06 13:29:42 +03:00
Vladimir Iakovlev
f7ce0fda25 Merge pull request #361 from nvbn/357-exclude-rules
#357 Add `exclude_rules` settings option
2015-09-06 12:59:34 +03:00
nvbn
2f9db24ed1 #357 Add exclude_rules settings option 2015-09-06 12:55:59 +03:00
Vladimir Iakovlev
4ae2e9bbc4 Merge pull request #359 from nvbn/use-pytest-docker-pexpect
Use pytest-docker-pexpect
2015-09-06 01:28:37 +03:00
nvbn
5cfd493d05 Make "arrows" tests less dependent on environment 2015-09-06 01:24:29 +03:00
nvbn
22eac045c8 Use @pytest.mark.once_without_docker 2015-09-06 01:14:49 +03:00
nvbn
cdd5f21e88 Add functional marker 2015-09-06 01:13:44 +03:00
nvbn
8cc19daaaa Use pytest-docker-pexpect for func tests 2015-09-06 00:56:18 +03:00
nvbn
8bf4182f86 Fix install script on non-ubuntu 2015-09-05 11:54:59 +03:00
nvbn
6df772ba05 Bump to 2.9.1 2015-09-05 11:46:34 +03:00
nvbn
e2e8b6fc86 Fix without result 2015-09-05 11:45:39 +03:00
nvbn
faa7ee6030 Bump to 2.9 2015-09-05 11:21:21 +03:00
nvbn
6321f25533 Fix bare run of func tests 2015-09-02 13:52:06 +03:00
nvbn
9a02e821cd Fix python 2 support 2015-09-02 11:54:58 +03:00
nvbn
4129ff2717 #353 Cache aliases in a temporary file 2015-09-02 11:10:03 +03:00
nvbn
ea6600be8b Kill containers after func tests 2015-09-02 10:33:45 +03:00
nvbn
b0195a8748 Reorganize imports 2015-09-02 09:43:40 +03:00
Vladimir Iakovlev
fc35ee657e Merge pull request #354 from mcarton/patch-1
Some README fixes
2015-09-02 09:37:28 +03:00
Vladimir Iakovlev
50207d8180 Merge pull request #352 from mcarton/slow
Fix slowness problems II
2015-09-02 09:36:48 +03:00
Martin Carton
b6855587fa Some README fixes 2015-09-02 00:05:14 +02:00
nvbn
45d849b1ac Use thefuck --alias in func tests 2015-09-01 18:36:25 +03:00
Vladimir Iakovlev
d8027bb499 Merge pull request #348 from myoung34/master
fix usage. why not
2015-09-01 18:21:21 +03:00
nvbn
4932122f71 #349 Add installation of command-not-found in install script 2015-09-01 18:18:28 +03:00
nvbn
8a4f4eea45 #349 Add note about python-commandnotfound dependency 2015-09-01 18:10:53 +03:00
mcarton
ff8d61a4fb Merge branch 'master' of github.com:nvbn/thefuck into slow 2015-09-01 14:43:41 +02:00
nvbn
6dcf9a3a14 Fix python 2 support 2015-09-01 15:32:23 +03:00
mcarton
8b62959fe3 Merge branch 'master' of github.com:nvbn/thefuck into slow 2015-09-01 14:28:30 +02:00
nvbn
21103d1b50 Simplify corrector steps 2015-09-01 14:43:27 +03:00
nvbn
61937e9e8f #334: Wait only for first matched rule; regression: always show arrows 2015-09-01 14:34:41 +03:00
nvbn
5d74344994 Make CorrectedCommand ignore priority when checking equality 2015-09-01 13:03:24 +03:00
nvbn
12394ca842 #334: Don't wait for all rules before showing result 2015-09-01 12:51:41 +03:00
nvbn
ebe53f0d18 Use decorator library 2015-08-27 16:52:26 +03:00
nvbn
0c283ff2b8 #334 Speed-up rules with caching for_app decorator 2015-08-27 16:42:09 +03:00
nvbn
bc78f1bbee git push origin masterMerge branch 'mlk-35_mvn' 2015-08-27 16:11:00 +03:00
nvbn
f2a7364e8c #351 Speed-up mvn rules, pep8 fixes 2015-08-27 16:10:50 +03:00
nvbn
9103c1ffd5 Add is_app/for_app helpers 2015-08-27 16:08:29 +03:00
nvbn
edf77a90ad Merge branch '35_mvn' of https://github.com/mlk/thefuck into mlk-35_mvn 2015-08-27 14:09:03 +03:00
mcarton
27c14a44af Fix tests
Thanks to [scorphus] for his [help].

[scorphus]: https://github.com/scorphus
[help]: https://github.com/nvbn/thefuck/pull/352#issuecomment-135248982
2015-08-27 10:54:42 +02:00
mcarton
514bb7df81 Don't run a shell just to run another shell 2015-08-26 23:38:33 +02:00
mcarton
3bd2c8d4c8 Remove unused imports 2015-08-26 21:43:20 +02:00
mcarton
e5ce000399 Improve the ssh_known_hosts rule import time 2015-08-26 21:43:20 +02:00
mcarton
9fc2bc904c Slightly improve the fix_file rule 2015-08-26 21:43:20 +02:00
mcarton
51f1f44162 Memoize thefuck.utils.which
It is used by some rules to determine if they should be enabled by
default and searches in the $PATH, which can be quiet slow.
2015-08-26 21:43:20 +02:00
mcarton
b0702d309f Improve brew* rules import time 2015-08-26 21:43:16 +02:00
mcarton
2b750bac8b Log rule import times 2015-08-26 19:14:38 +02:00
Michael Lee
8c02658a32 Removed debug statement 2015-08-26 15:02:46 +01:00
Michael Lee
301de75aee #35 - Fuzzy matching on maven lifecycle targets 2015-08-26 14:58:45 +01:00
Michael Lee
0d86fce9be #35 mvn will auto add clean package 2015-08-26 14:01:36 +01:00
nvbn
7be71a0121 #334 Add performance test 2015-08-26 14:34:39 +03:00
nvbn
354ae119c6 Don't duplicate project root in tests 2015-08-26 12:12:52 +03:00
myoung34
a2b2e5b5b8 fix usage. why not 2015-08-25 16:40:22 -05:00
nvbn
b21c9ebb43 Move all app/os specific utils to specific package 2015-08-25 14:09:47 +03:00
nvbn
2e002f666b Move utility functions from archlinux to utils 2015-08-25 13:55:33 +03:00
Vladimir Iakovlev
4163fb5f2e Merge pull request #340 from BuZZ-T/feature/apt-get-search
Adding rule for trying to search using apt-get
2015-08-25 13:48:41 +03:00
nvbn
e72c88e344 #346 Add support of other systems with get-pip 2015-08-25 13:47:30 +03:00
nvbn
f4eebbaaf9 #346 Improve installation script 2015-08-25 12:03:42 +03:00
nvbn
5e5a8e4dfa #346 Restart shell session after install 2015-08-25 10:18:21 +03:00
Bastian Gebhardt
8cbe236845 Adding rule for trying to search using apt-get 2015-08-25 08:09:31 +02:00
Bastian Gebhardt
2b3e8dc62a Adding rule for trying to search using apt-get 2015-08-25 00:20:21 +02:00
nvbn
5ab2cf646e Bump to 2.8 2015-08-24 20:31:28 +03:00
Vladimir Iakovlev
c5b4628c5c Update README.md 2015-08-24 20:27:11 +03:00
nvbn
d4cec3e850 Update readme 2015-08-24 20:25:59 +03:00
nvbn
564638c171 Add experimental installation script 2015-08-24 20:25:03 +03:00
nvbn
c6171a85e9 Improve readme test 2015-08-24 11:25:49 +03:00
Vladimir Iakovlev
ee610032b8 Merge pull request #345 from mcarton/slow
Fix slowness problems
2015-08-24 11:19:48 +03:00
mcarton
6754ebe20d Fix some spelling mistakes 2015-08-23 21:27:38 +02:00
mcarton
15d19fdf9c Fix slowness problems
The `get_aliases()` function was also sometimes called through
`shell.get_aliases()`.
Since the `history` rule also uses aliases, the shell was always
executed twice to get the aliases list.
2015-08-23 21:22:54 +02:00
Vladimir Iakovlev
967e30d914 Merge pull request #344 from trolley/typo-fix
Fix typo in alias warning
2015-08-23 16:39:31 +03:00
Mark Trolley
38ee31ebcb Fix typo in alias warning
Fixes a small typo in the deprecated alias warning.
2015-08-22 10:01:24 -04:00
Vladimir Iakovlev
7315958ea9 Merge pull request #343 from mlk/hdfs-rm-rm_X_Is_a_directory_add_minus_r
hdfs -rm -r /directory and hdfs -mkdir -p /directory/sub support
2015-08-21 18:34:19 +03:00
Vladimir Iakovlev
cce25b1ea4 Merge pull request #342 from mlk/322_vagrant
Issue: 322 Runs vagrant up when required
2015-08-21 18:33:42 +03:00
Michael Lee
1a57ef03c8 Removed additional assert 2015-08-21 16:06:12 +01:00
Michael Lee
298c04f89c Support for hdfs dfs -mkdir -p /directory/subdirectory 2015-08-21 16:05:49 +01:00
Michael Lee
42a8b4f639 Support for hdfs dfs -rm /directory 2015-08-21 15:48:54 +01:00
Michael Lee
336d8b7b4b Style change 2015-08-20 11:37:49 +01:00
Michael Lee
feb3eee2a0 Support for either starting only the machine requested, or starting all machines 2015-08-20 10:06:41 +01:00
Michael Lee
7cb0388ed0 Not matched unit tests, code style. 2015-08-20 09:41:01 +01:00
Michael Lee
004c0d06eb starts up vagrant if not already running 2015-08-19 17:12:54 +01:00
Vladimir Iakovlev
abbbd1f8eb Merge pull request #339 from mcarton/fix-338
Fix #338
2015-08-19 17:19:38 +03:00
Vladimir Iakovlev
700d9ac7e9 Merge pull request #337 from mcarton/cleanup
Some cleanup and fixes
2015-08-19 17:19:08 +03:00
Vladimir Iakovlev
8037a17b73 Merge pull request #333 from mlk/master
basic support for the hdfs dfs <command> when the command misses the …
2015-08-19 17:16:54 +03:00
mcarton
49917ce6b4 Fix #338 2015-08-19 11:00:27 +02:00
mcarton
c5e1139879 Fix some issues reported by pylint 2015-08-17 17:19:16 +02:00
mcarton
1becd92b12 Fix the open rule
It was simply wrong with `xdg-`, `gnome-` and `kde-open`.
2015-08-17 16:22:05 +02:00
mcarton
bc6b107066 Fix README and add a test so it won't happen again 2015-08-17 16:07:24 +02:00
mcarton
9b30ae0424 Handle columns it the fix_file rule 2015-08-17 16:07:24 +02:00
mcarton
88831c424f Fix the @wrap_settings annotation
It seems much more useful if it only adds settings that are not already
set.
2015-08-17 16:07:24 +02:00
mcarton
4a2f869c6d Add support for stdout in the fix_file rule
At least `pep8` and `py.test` consider errors as normal and print them
on stdout.
2015-08-17 16:07:24 +02:00
mcarton
7f0f9a966f Fix some pep8 issues, mostly spaces
Before:
    4       E101 indentation contains mixed spaces and tabs
    20      E122 continuation line missing indentation or outdented
    1       E124 closing bracket does not match visual indentation
    12      E127 continuation line over-indented for visual indent
    22      E128 continuation line under-indented for visual indent
    2       E211 whitespace before '('
    12      E302 expected 2 blank lines, found 1
    1       E303 too many blank lines (3)
    4       E402 module level import not at top of file
    123     E501 line too long (81 > 79 characters)
    2       E731 do not assign a lambda expression, use a def
    3       W191 indentation contains tabs
    20      W291 trailing whitespace
    3       W293 blank line contains whitespace
    2       W391 blank line at end of file
    69      W503 line break before binary operator

After:
    20      E122 continuation line missing indentation or outdented
    12      E127 continuation line over-indented for visual indent
    22      E128 continuation line under-indented for visual indent
    123     E501 line too long (81 > 79 characters)
    2       E731 do not assign a lambda expression, use a def
    1       W291 trailing whitespace
    68      W503 line break before binary operator
2015-08-17 16:07:10 +02:00
Vladimir Iakovlev
85647794dc Merge pull request #335 from mcarton/pacman
Add a new rule for pacman/yaourt and fix the apt_get rule
2015-08-16 03:38:50 +03:00
Michael Lee
8c9416e57f Renamed to unknown command to better match current functionality 2015-08-14 09:38:42 +01:00
mcarton
95607557d6 #277 Fix the apt_get rule with sudo 2015-08-13 18:29:04 +02:00
mcarton
e9ffe2ea9d Fix confusing sentence in the README
Ref: https://github.com/nvbn/thefuck/pull/283#issuecomment-120170664
2015-08-13 18:28:59 +02:00
Michael Lee
c08a8bddc9 More generic a solution, now works with any command that follows the same pattern of error message 2015-08-13 17:19:16 +01:00
mcarton
ca8222e764 Add the pacman_not_found rule 2015-08-13 18:16:25 +02:00
mcarton
986bbb30a7 Create thefuck.archlinux 2015-08-13 18:07:24 +02:00
Michael Lee
2cdfe105fb Reorderd be in alphabetical order 2015-08-13 16:23:11 +01:00
Michael Lee
b494c4e273 basic support for the hdfs dfs <command> when the command misses the dash 2015-08-13 13:09:19 +01:00
Vladimir Iakovlev
0ad70a1edc Merge pull request #332 from mcarton/331
#331 Fix bug with empty commands
2015-08-11 16:04:00 +03:00
mcarton
285d57eb01 #331 Fix bug with empty commands 2015-08-11 11:08:21 +02:00
nvbn
d20205249b Bump to 2.7 2015-08-11 01:17:06 +03:00
nvbn
b29113c229 #326 Add support of sudo with pipes 2015-08-11 01:15:05 +03:00
nvbn
41a0a766ce Merge branch 'master' of github.com:nvbn/thefuck 2015-08-09 22:56:00 +03:00
nvbn
6222985491 #330 Add support of a single argument 2015-08-09 22:55:48 +03:00
Vladimir Iakovlev
e09e5a9683 Merge pull request #329 from JakobGreen/master
Change failed message 'No fuck given' to the more popular 'No fucks g…
2015-08-08 04:45:42 +03:00
JakobGreen
6883d2dbeb Change failed message 'No fuck given' to the more popular 'No fucks given' 2015-08-07 14:51:51 -06:00
Vladimir Iakovlev
215c64d924 Merge pull request #327 from bugaevc/must-run-as-root
Add one more 'need root' phrase
2015-08-07 18:50:42 +03:00
Sergey Bugaev
ab76f87e01 Add one more 'need root' phrase 2015-08-06 20:33:31 +03:00
nvbn
fd759ea2ac #298 Don't suggest duplicates 2015-08-01 19:16:22 +03:00
nvbn
213e7bf74b #301 Fix UnicodeEncodeError in debug time tracker 2015-08-01 18:56:20 +03:00
Vladimir Iakovlev
1a2c1aa4e9 Merge pull request #325 from mcarton/324
Some adaptations for #324
2015-08-01 00:17:56 +03:00
mcarton
fc48e69921 Adapt the whois rule to #342 2015-07-31 22:19:16 +02:00
mcarton
88732a608e Adapt the tmux rule to #324 2015-07-31 22:19:16 +02:00
mcarton
8374be0872 Adapt the pacman rule to #324 2015-07-31 22:18:59 +02:00
mcarton
3ae01ac65d Adapt the man rule to #324 2015-07-31 21:41:07 +02:00
mcarton
4d467cce95 #324 Remove arrows in case there is only one match 2015-07-31 20:59:49 +02:00
Vladimir Iakovlev
8be353941f Merge pull request #324 from nvbn/298-variants
Add ability to select fixed command from variants
2015-07-31 15:39:57 +03:00
nvbn
d442f959e9 #298 Update readme 2015-07-31 15:36:08 +03:00
nvbn
cb2cddbdd9 #298 Fix zsh tests with BARE 2015-07-31 15:31:51 +03:00
nvbn
8632a29edc #298 Fix tests with BARE 2015-07-31 15:04:06 +03:00
nvbn
36a0a669b0 Bump to 2.6 2015-07-30 20:27:47 +03:00
nvbn
214acf56c5 #298 Wait before checking that history changed 2015-07-30 20:04:40 +03:00
nvbn
da3bc60942 #298 Fix arrow-tests on travis-ci 2015-07-30 18:39:41 +03:00
nvbn
70c89164b0 #298 Add func tests for selecting rule 2015-07-30 18:28:20 +03:00
nvbn
1a76bfd2a3 #298 Always clean-up after building container 2015-07-30 18:17:29 +03:00
Vladimir Iakovlev
b16de9c7c2 Merge pull request #323 from mcarton/fix-file
#320 Add the `fix_file` rule
2015-07-30 18:05:50 +03:00
mcarton
43fead02d3 Test if the file exists in the fix_file rule
This avoid false positives in `match`.
2015-07-30 16:42:00 +02:00
mcarton
de513cacb1 Show user's $EDITOR in output
It looks nicer with confirmation and also checks the user actually has an
$EDITOR.
2015-07-29 21:35:06 +02:00
mcarton
e4b97af73e #320 Add the fix_file rule 2015-07-29 21:03:47 +02:00
nvbn
9d91b96780 #298 Simplify func tests 2015-07-29 16:30:32 +03:00
nvbn
8962cf2ec1 #298 Use eager decorator when we don't need lazines 2015-07-29 16:11:23 +03:00
nvbn
d6e80b7835 #298 Suggest more than one result in *_no_command rules 2015-07-29 16:09:26 +03:00
nvbn
4bc1cc7849 #298 Add support of list results in sudo_support 2015-07-29 15:40:21 +03:00
nvbn
e6af00ef97 #298 Fix selecting command 2015-07-29 15:33:29 +03:00
nvbn
c8550a0ce5 #298 Fix python 2 support 2015-07-29 15:22:24 +03:00
Vladimir Iakovlev
0a40e7f0a9 Merge pull request #321 from mcarton/patch-1
Force the travis image to track the master branch
2015-07-29 15:06:44 +03:00
Martin Carton
9c649c05a9 Force the travis image to track the master branch 2015-07-28 23:59:17 +02:00
nvbn
7933e963d8 #298 Add ability to chose matched rule 2015-07-28 22:04:27 +03:00
nvbn
4fc18cb4e7 Decrease count of psutils calls 2015-07-28 16:26:26 +03:00
Vladimir Iakovlev
5d1dd70652 Merge pull request #319 from scorphus/tsuru-not-command
Add a new `tsuru_not_command` rule
2015-07-28 16:20:46 +03:00
Pablo Santiago Blum de Aguiar
65a25d5448 Add a new tsuru_not_command rule 2015-07-27 22:34:24 -03:00
Pablo Santiago Blum de Aguiar
4e854a575e Move get_all_matched_commands over to utils 2015-07-27 22:29:02 -03:00
nvbn
742200a500 #311 Fix build in travis-ci 2015-07-27 23:38:04 +03:00
nvbn
44cd1fd7e1 #311 Fix installation without pandoc 2015-07-27 23:31:06 +03:00
nvbn
dc16600871 #311 Manually convert md to rst 2015-07-27 23:23:26 +03:00
nvbn
af40ad84d8 Bump to 2.5 2015-07-27 22:23:26 +03:00
nvbn
63e62fcba3 #311 Use setuptools-markdown 2015-07-27 22:23:20 +03:00
nvbn
368be788d7 Fix tests in python 2 2015-07-27 17:51:33 +03:00
nvbn
cd1468489f Fix history tests in travis-ci? 2015-07-27 17:47:02 +03:00
nvbn
fbce86b92a Merge branch 'mcarton-unzip-clean' 2015-07-27 17:40:04 +03:00
nvbn
3f6652df66 #313 Add new command options to readme 2015-07-27 17:39:52 +03:00
nvbn
cf82af8978 #313 Remove types.Script, use Command with None as stdout and stderr 2015-07-27 17:39:41 +03:00
nvbn
20f51f5ffe Merge branch 'unzip-clean' of https://github.com/mcarton/thefuck into mcarton-unzip-clean 2015-07-27 17:29:09 +03:00
nvbn
8f6d8b1dd1 Add tests for history changes fro bash and zsh 2015-07-27 17:28:09 +03:00
Vladimir Iakovlev
c0002fe6e0 Merge pull request #317 from SanketDG/setup_fix
fix setup.py version checking
2015-07-27 01:05:25 +03:00
Vladimir Iakovlev
6609b8d06a #316 Remove .py from tsuru_login rule name 2015-07-26 22:09:55 +03:00
Vladimir Iakovlev
5b5df9361d Merge pull request #316 from scorphus/tsuru-login
Add `tsuru_login` rule
2015-07-26 22:08:51 +03:00
Vladimir Iakovlev
fa234fde70 Merge pull request #315 from scorphus/fix-tests
Fix git_push_pull and not_match tests
2015-07-26 22:08:09 +03:00
SanketDG
867aec83c3 fix setup.py version checking 2015-07-26 23:47:56 +05:30
Pablo Santiago Blum de Aguiar
2117659c40 Add tsuru_login rule 2015-07-25 23:33:38 -03:00
Pablo Santiago Blum de Aguiar
4985f75d74 Allow generic_shell to act while testing git_push_pull
Fix failing tests on shells that do not use && operator
2015-07-25 23:26:52 -03:00
Pablo Santiago Blum de Aguiar
959d20df78 Add test_not_match to no_such_file tests 2015-07-25 23:26:47 -03:00
mcarton
8529461742 Update README 2015-07-25 23:14:10 +02:00
mcarton
3173ef10c6 Change the message when expecting side effect
The previous behavior is really surprising:
```
    some_command* [enter/ctrl+c]
   |<~~~~~~~~~~~>|<~~~~~~~~~~~~>|
   |  bold text  | normal weight|
```
as if the '*' is part of the command to be executed.
The new behavior is:
```
    some_command (+side effect) [enter/ctrl+c]
   |<~~~~~~~~~~>|<~~~~~~~~~~~~~~~~~~~~~~~~~~~>|
   |  bold text |        normal weight        |
```
2015-07-25 23:10:21 +02:00
mcarton
1c5fef3a34 Add tests for the dirty_untar rule 2015-07-25 23:06:20 +02:00
mcarton
386e6bf0c3 Add the dirty_tar rule 2015-07-25 23:06:09 +02:00
mcarton
1146ab654c Add tests for the dirty_unzip rule 2015-07-25 23:06:00 +02:00
mcarton
4e7eceaa3a Add a dirty_unzip rule 2015-07-25 23:05:06 +02:00
mcarton
71bb1994c3 Allow rules to correct commands that time out 2015-07-25 23:04:08 +02:00
nvbn
bfa3c905a3 Improve assertions in func tests 2015-07-25 21:02:04 +03:00
nvbn
992f488159 Bump to 2.4 2015-07-25 03:40:06 +03:00
nvbn
7770efb86c Fix skipif on fish tests 2015-07-25 03:38:17 +03:00
nvbn
b2457d1587 Fix skipif on fish tests 2015-07-25 03:35:55 +03:00
nvbn
2291a5ba5d Use only one skipif 2015-07-25 03:33:30 +03:00
nvbn
129d67f794 Temporary disable functional tests with fish in travis-ci
https://github.com/travis-ci/apt-source-whitelist/issues/71
2015-07-25 03:30:11 +03:00
nvbn
d00295f9d8 Fix fish version in travis-ci 2015-07-25 03:22:16 +03:00
nvbn
8498b970cc Fix tests with python 2 2015-07-25 03:22:05 +03:00
nvbn
8d981cf9b6 Fix env in travis config 2015-07-25 03:02:04 +03:00
nvbn
2da3d02361 Add BARE option for running functional tests without docker 2015-07-25 03:01:03 +03:00
nvbn
d7c8a43bbb Merge branch 'master' of github.com:nvbn/thefuck 2015-07-24 23:50:30 +03:00
nvbn
14e4158c7a Add tests for tcsh, fix tcsh alias 2015-07-24 23:50:22 +03:00
Vladimir Iakovlev
0d378ccf28 Merge pull request #312 from SanketDG/desc
fix description not appearing on pypi page
2015-07-24 23:32:45 +03:00
Vladimir Iakovlev
ff117f2d69 Merge pull request #310 from mcarton/patch-2
Make a `sudo` pattern more general
2015-07-24 23:32:12 +03:00
nvbn
41350d13a8 Revert "#N/A Run functional tests in travis-ci"
This reverts commit 9e79c4aea3.
2015-07-24 23:31:21 +03:00
nvbn
09a4438d69 Revert "#N/A Run functional tests in travis-ci"
This reverts commit c6ec2df85b.
2015-07-24 23:31:16 +03:00
nvbn
c6ec2df85b #N/A Run functional tests in travis-ci 2015-07-24 23:27:04 +03:00
nvbn
9e79c4aea3 #N/A Run functional tests in travis-ci 2015-07-24 23:24:14 +03:00
nvbn
9ab4491b96 #N/A Add tests for "ctrl+c" 2015-07-24 23:14:58 +03:00
SanketDG
fb8174b5e5 fix description not appearing on pypi page 2015-07-24 22:04:12 +05:30
Martin Carton
aaa66b6268 Make a sudo pattern more general
```
% mount -o uid=martin /dev/sdc1 mnt
mount: only root can use "--options" option
```
2015-07-24 16:33:53 +02:00
nvbn
174ada054d #N/A Implicitly prefix containers names 2015-07-24 08:09:08 +03:00
nvbn
e1416a0127 #N/A Add tests for fish 2015-07-24 08:04:49 +03:00
nvbn
c34a56bc89 #N/A Simplify functional tests 2015-07-24 07:38:45 +03:00
nvbn
7906025cc6 #N/A Add docker-based functional tests 2015-07-24 03:56:21 +03:00
nvbn
b15bc8c423 #N/A Add gulp_not_task rule 2015-07-24 00:47:57 +03:00
nvbn
469c5a60b0 #N/A Add replace_argument helper 2015-07-24 00:39:56 +03:00
nvbn
f9f0948349 #N/A Add docker_not_command rule 2015-07-24 00:12:29 +03:00
nvbn
b5f2d0afb5 #N/A Use get_closest in no_command rule 2015-07-23 23:42:29 +03:00
nvbn
ef2f642ffe #N/A Log common operations time 2015-07-23 06:09:57 +03:00
Vladimir Iakovlev
ca77261b89 Merge pull request #309 from mcarton/git
Add the `git_fix_stash` rule
2015-07-23 05:22:18 +03:00
mcarton
e4da8a2e5a Add the git_fix_stash rule 2015-07-22 23:27:53 +02:00
nvbn
ab1cd665cd #N/A Fix git_checkout tests 2015-07-22 04:52:52 +03:00
nvbn
a6c5b8322a #N/A Install coverall before project deps 2015-07-22 04:49:33 +03:00
nvbn
6c534c52bc Bump to 2.3 2015-07-22 04:45:04 +03:00
nvbn
b4392ba706 #N/A Add heroku_not_command rule 2015-07-22 04:44:37 +03:00
Vladimir Iakovlev
46f918718f Merge pull request #307 from evverx/lc_all
Force LC_ALL to C
2015-07-21 17:11:16 +03:00
Vladimir Iakovlev
d71ce76ae4 Merge pull request #306 from mcarton/hub
Support GitHub's hub command
2015-07-21 16:43:24 +03:00
nvbn
355505a0a8 #N/A Make git_checkout test less dependent on get_closest 2015-07-21 16:40:45 +03:00
Evgeny Vereshchagin
3d425ce831 Force LC_ALL to C
See: http://unix.stackexchange.com/a/87763/120177
2015-07-21 13:39:34 +00:00
mcarton
98a9fb3d7d Remove now redundant checks in git_* rules 2015-07-21 15:35:39 +02:00
nvbn
c8d748e095 Bump to 2.2 2015-07-21 16:31:17 +03:00
nvbn
e0af35819d Merge branch 'master' of github.com:nvbn/thefuck 2015-07-21 16:19:11 +03:00
nvbn
9e4c250e4e #301 Fix bash support on non-eng systems 2015-07-21 16:19:01 +03:00
Vladimir Iakovlev
8c395377f8 Merge pull request #299 from evverx/dnf-history
Add `dnf history` error for the sudo rule
2015-07-21 16:15:08 +03:00
Vladimir Iakovlev
f165523247 Merge pull request #304 from mcarton/fix-git_diff_staged
Fix the `git_diff_staged` rule
2015-07-21 16:12:19 +03:00
mcarton
903abff77e Support hub as well as git in @git_support 2015-07-21 15:06:04 +02:00
Evgeny Vereshchagin
6d39b78824 Add dnf history error for the sudo rule
$ dnf history
You don't have access to the history DB.
2015-07-21 12:56:25 +00:00
mcarton
1285303363 Fix the git_diff_staged rule
The problem was:
```
% git add foo
% git diff foo
% fuck
git diff foo --staged [enter/ctrl+c]
fatal: bad flag '--staged' used after filename
```
2015-07-21 14:06:37 +02:00
nvbn
66e2ec7e3f Merge branch 'mcarton-fix-readme' 2015-07-20 22:49:31 +03:00
nvbn
92cca7b641 #296 Fix [enter/ctrl+c] case in the readme 2015-07-20 22:49:21 +03:00
mcarton
e572cab1f3 Have the README look better 2015-07-20 21:12:39 +02:00
mcarton
33b1536c28 Move misplaced rule in README 2015-07-20 21:07:56 +02:00
mcarton
d4fada8e4c Reflect the new default for require_confirmation 2015-07-20 21:06:59 +02:00
mcarton
afc089bc3c Be more consistent in README 2015-07-20 20:49:21 +02:00
nvbn
300c8f528a #N/A Mention tcsh in readme 2015-07-20 21:27:19 +03:00
nvbn
7b011a504d #N/A Fix tests in travis 2015-07-20 21:24:00 +03:00
nvbn
164103693b Bump to 2.1 2015-07-20 21:16:53 +03:00
nvbn
a21c99200e #294 Mention common shells configs in readme 2015-07-20 21:15:34 +03:00
nvbn
1b961c4b87 #294 Move entry point for alias to main 2015-07-20 21:14:43 +03:00
nvbn
a849b65352 Merge branch 'easy-install' of https://github.com/mcarton/thefuck into mcarton-easy-install 2015-07-20 21:06:21 +03:00
nvbn
dee018e792 #N/A Move get_all_executables (formerly get_all_callables) to utils 2015-07-20 21:04:49 +03:00
nvbn
c67560864a #295 Add git_push_pull rule 2015-07-20 20:51:18 +03:00
Vladimir Iakovlev
b636e9bec7 Merge pull request #295 from mcarton/new-git-rules
New git rules
2015-07-20 20:42:02 +03:00
nvbn
36450b740f #270 Add default priority in the readme 2015-07-20 20:01:45 +03:00
mcarton
0f67aad93b Update README 2015-07-20 18:58:16 +02:00
mcarton
bb7579ead5 Add the git_pull_clone rule 2015-07-20 18:58:16 +02:00
mcarton
569709388d Add a git_push_force rule 2015-07-20 18:58:11 +02:00
nvbn
baf7796295 #129 Ignore thefuck alias in switch_lang rule 2015-07-20 19:40:45 +03:00
nvbn
7b32f1df04 #N/A Fix debug output with unicode commands 2015-07-20 19:35:32 +03:00
nvbn
cd084c8ba6 #N/A Fix history rule with blank history 2015-07-20 19:30:41 +03:00
nvbn
4f5659caad #87 Add ability to fix branch names in git_checkout rule 2015-07-20 19:25:29 +03:00
mcarton
370f258b89 Change installation method in README 2015-07-20 13:40:07 +02:00
mcarton
9a069daada Make thefuck-alias generated alias a parameter 2015-07-20 13:35:22 +02:00
nvbn
ee87d1c547 #N/A Ignore history lines before fuck call in history rule 2015-07-20 01:53:32 +03:00
Vladimir Iakovlev
7e03b55729 Merge pull request #293 from mcarton/git-aliases
#292 #290 Use @git_support in all git rules
2015-07-20 01:25:25 +03:00
mcarton
db76462802 #292 #290 Use @git_support in all git rules 2015-07-20 00:08:01 +02:00
Vladimir Iakovlev
dbf20ebc73 Fix typo 2015-07-19 22:41:10 +03:00
Vladimir Iakovlev
b8a74b1425 Remove barely working coveralls badge 2015-07-19 22:40:25 +03:00
nvbn
4fb990742d Bump to 2.0 2015-07-19 22:33:56 +03:00
nvbn
cf3dca6f51 #284 Add coveralls support 2015-07-19 21:57:19 +03:00
nvbn
5187bada1b #N/A Update readme 2015-07-19 21:53:08 +03:00
nvbn
0238569b71 #N/A Require confirmation by default 2015-07-19 21:52:46 +03:00
nvbn
463b4fef2f Merge branch 'mcarton-git-aliases' 2015-07-19 21:29:39 +03:00
nvbn
f90bac10ed #290: Fix typo 2015-07-19 21:29:28 +03:00
nvbn
90014b2b05 Merge branch 'git-aliases' of https://github.com/mcarton/thefuck into mcarton-git-aliases 2015-07-19 21:27:04 +03:00
Vladimir Iakovlev
4276cacaf6 Merge pull request #292 from SimenB/delete-git-branch
Add git_branch_delete rule
2015-07-19 21:26:39 +03:00
Simen Bekkhus
b31aea3737 Add git_branch_delete rule 2015-07-19 13:45:46 +02:00
nvbn
fbfb4b5e41 Merge branch 'petr-tichy-master' 2015-07-18 17:19:57 +03:00
Petr Tichý
51c37bc5ab Fix wheel dependencies for Python 2 2015-07-17 18:51:35 +02:00
mcarton
5d0912fee8 Unquote over-quoted commands in @git_support
This allows writing rules more easily (eg. the git_branch_list rule
tests for `command.script.split() == 'git branch list'.split()`) and
looks nicer when `require_confirmation` is set.
2015-07-17 14:07:17 +02:00
mcarton
f6a4902074 Use @git_support in all git_* rules 2015-07-17 13:11:36 +02:00
mcarton
707d91200e Make the environment a setting
This would allow other rules to set the environment as needed for
`@git_support` and `GIT_TRACE`.
2015-07-17 11:37:13 +02:00
mcarton
b3e09d68df Start support for git aliases 2015-07-16 20:23:31 +02:00
nvbn
78769e4fbc Bump to 1.49 2015-07-15 07:49:18 +03:00
nvbn
3e4c043ccc #280: Add debug output 2015-07-15 07:47:54 +03:00
nvbn
934099fe9e #289: Add is a directory pattern to cp_omitting_directory rule 2015-07-15 07:12:07 +03:00
Vladimir Iakovlev
464f86eccf Merge pull request #288 from scorphus/overridden-aliases
fix(fish.get_aliases): do not include overridden aliases
2015-07-15 06:58:32 +03:00
Pablo Santiago Blum de Aguiar
891fbe7ed1 fix(fish.get_aliases): do not include overridden aliases
Fish Shell overrides some shell commands, such as `cd` and `ls` and
therefore some rules fail to match. The following aliases are excluded
by default:

 * cd
 * grep
 * ls
 * man
 * open

To change them, one can use the `TF_OVERRIDDEN_ALIASES` environment
variable such as:

```
set TF_OVERRIDDEN_ALIASES 'cd,grep,ls'
```

Fix #262
2015-07-13 22:53:15 -03:00
nvbn
5abab8bd1e Merge branch 'master' of github.com:nvbn/thefuck 2015-07-10 17:58:53 +03:00
nvbn
7ebc8a38af #N/A Add history rule 2015-07-10 17:58:41 +03:00
nvbn
f40b63f44b #N/A Add ability to disable memoization in tests 2015-07-10 17:06:05 +03:00
nvbn
4b4e7acc0f #N/A Add ability to get shell history 2015-07-10 16:42:21 +03:00
Vladimir Iakovlev
a8587d3871 Merge pull request #285 from mcarton/tmux
Use `get_closest` in the tmux rule
2015-07-10 15:54:14 +03:00
mcarton
370c58e679 Use get_closest in the tmux rule 2015-07-10 09:49:49 +02:00
Vladimir Iakovlev
328e65179e Merge pull request #283 from mcarton/mercurial
Some fixes in REAME.md
2015-07-09 20:13:38 +03:00
Vladimir Iakovlev
63bb4da8e1 Merge pull request #282 from mcarton/sudo
Add systemd's kind of error for the sudo rule
2015-07-09 20:13:17 +03:00
mcarton
0b5a7a8e2d Fix rule name in README 2015-07-09 18:35:33 +02:00
mcarton
5693bd49f7 #281 Add the mercurial rule to README.md 2015-07-09 18:01:44 +02:00
mcarton
12f8d017b9 Add systemd's kind of error for the sudo rule
A complete error would be:

```
% systemctl daemon-reload
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===
Authentication is required to reload the systemd state.
Authenticating as: martin
Password:
```
2015-07-09 17:24:45 +02:00
nvbn
c7071763a3 Bump to 1.48 2015-07-08 21:34:39 +03:00
nvbn
27b5b9de6a #229 Use closest git command 2015-07-08 21:33:30 +03:00
nvbn
c0eae8b85c #N/A Add get_closest utility function 2015-07-08 21:30:24 +03:00
nvbn
fbf7b91005 Bump to 1.47 2015-07-07 16:39:40 +03:00
nvbn
3d842fe6eb #N/A Fix setup.py 2015-07-07 16:39:21 +03:00
Vladimir Iakovlev
17d359b43f Merge pull request #281 from scorphus/mercurial
improve(rules): add mercurial (hg) support
2015-07-07 16:36:06 +03:00
nvbn
22503cdb94 #279 Fix merge 2015-07-07 16:34:30 +03:00
nvbn
a8de919300 Merge branch 'master' of https://github.com/mkreder/thefuck into mkreder-master 2015-07-07 16:33:58 +03:00
nvbn
fac18de242 #267 Compare version_info with a tuple 2015-07-07 16:33:41 +03:00
Vladimir Iakovlev
26fc18dfe4 Merge pull request #278 from mcarton/sed
Add a sed_unterminated_s rule
2015-07-07 16:30:42 +03:00
Vladimir Iakovlev
0fb5c9a228 Merge pull request #277 from mcarton/fix-sudo
Fix the pacman rule with `sudo`
2015-07-07 16:30:02 +03:00
Vladimir Iakovlev
04a342bbc7 Merge pull request #276 from mcarton/tmux
Add a tmux rule
2015-07-07 16:29:15 +03:00
Vladimir Iakovlev
669fbff6ce Merge pull request #272 from scorphus/issue-271-ls-lah
fix(rules.ls_lah): make sure script starts with ls
2015-07-07 16:28:49 +03:00
Vladimir Iakovlev
e2542915e4 Merge pull request #267 from SanketDG/version_check
add python version testing in setup.py
2015-07-07 16:28:28 +03:00
Vladimir Iakovlev
1b08a7dcb6 Merge pull request #265 from mcarton/open
Open
2015-07-07 16:27:33 +03:00
Pablo Santiago Blum de Aguiar
8d77a2d528 improve(rules): add mercurial (hg) support
Fix #269
2015-07-06 21:37:31 -03:00
Matias Kreder
18ea4272ab change deps to install_requires #2 2015-07-04 12:26:56 -03:00
Matias Kreder
a75c99eb12 change deps to install_requires 2015-07-04 12:24:09 -03:00
mcarton
f3cdfbdbdb Add a sed_unterminated_s rule 2015-07-04 17:10:11 +02:00
Matias Kreder
30082bc9a9 fixed dependency problem, on python 3.4.0 pathlib is included in the python distribution so it must not be included in the requirements for thefuck otherwise it wont run at startup 2015-07-04 11:55:28 -03:00
mcarton
3822f62d90 Add a tmux rule 2015-07-04 14:17:33 +02:00
Pablo Santiago Blum de Aguiar
25cc98a21a fix(rules.ls_lah): make sure script starts with ls
Fix #271
2015-07-03 14:24:45 -03:00
SanketDG
409d839e92 add python version testing in setup.py 2015-07-03 00:29:07 +05:30
mcarton
51b5dd0460 Fix the pacman rule with sudo
Does not use @sudo_support as this does not place 'sudo' at the right
position.
2015-06-28 22:10:34 +02:00
Vladimir Iakovlev
cb33c912e5 Merge pull request #264 from mcarton/cleanup
Cleanup
2015-06-26 17:30:14 +03:00
Vladimir Iakovlev
470d66eeb2 Merge pull request #263 from mcarton/test.py
Add a test.py rule
2015-06-26 17:28:24 +03:00
mcarton
5552fd3dc9 s/compile/execute when talking about Python
The word 'compile' is just misleading here.
2015-06-26 14:54:33 +02:00
mcarton
ab55c1cccb Add other flavors of open command 2015-06-26 14:52:34 +02:00
mcarton
7173e0dbad Use spaces instead of tabs
The is more common in python and follows other rules usage.
2015-06-26 14:50:01 +02:00
mcarton
369ea7ff46 Add a test.py rule 2015-06-26 14:05:18 +02:00
mcarton
40fe604adc Replace use of '&&' by shells.and_ 2015-06-26 13:58:50 +02:00
mcarton
ef504b6436 Add a few other common patterns for the open rule 2015-06-26 13:45:23 +02:00
mcarton
b59e83cca9 Fix punctuation in README.md 2015-06-26 12:02:05 +02:00
mcarton
6d718a38dc :sort rules in README 2015-06-26 12:00:16 +02:00
mcarton
330f91f5dc Cleanup the systemctl rule 2015-06-26 11:55:10 +02:00
mcarton
e3cc9c52e6 Remove redundant patterns in sudo rule 2015-06-26 11:41:55 +02:00
mcarton
01ce65047a Use spaces instead of tabs
This is more common in python and follows other rules usage.
2015-06-26 11:27:04 +02:00
Vladimir Iakovlev
3203d57b36 Merge pull request #261 from maciekmm/rule-systemctl
Added systemctl rule
2015-06-24 13:50:36 +03:00
Maciej Mionskowski
28ab6c62f8 Added systemctl rule to README.md 2015-06-24 11:07:03 +02:00
Maciej Mionskowski
360e4673eb Added systemctl rule 2015-06-24 09:36:09 +02:00
Vladimir Iakovlev
c6aead735b Merge pull request #259 from diezcami/master
Added Python Compile Rule
2015-06-22 19:19:41 +03:00
Cami Diez
af3e1a555f Edited python compile rule 2015-06-21 09:27:03 +08:00
Cami Diez
897b847975 Added rule 2015-06-21 09:25:20 +08:00
Cami Diez
a0949b1102 Added Python Compile Rule 2015-06-21 09:24:27 +08:00
nvbn
2f1460120e Merge branch 'master' of github.com:nvbn/thefuck 2015-06-16 13:53:24 +03:00
nvbn
43ec397190 #252 Fix bash and zsh aliases 2015-06-16 13:52:41 +03:00
nvbn
eb537bef81 Merge branch 'issue-221-tf-alias' of https://github.com/scorphus/thefuck into scorphus-issue-221-tf-alias 2015-06-16 13:49:17 +03:00
Vladimir Iakovlev
b033d3893b Merge pull request #256 from scorphus/psutil-children
fix(main.wait_output): use Process’ children() instead of get_children()
2015-06-16 13:47:30 +03:00
nvbn
633c4f8415 #257 sudo patterns are case insensitive 2015-06-16 13:46:18 +03:00
TJ Horner
5bfe0ac997 One more trigger word 2015-06-15 17:13:21 -07:00
TJ Horner
e8a55220ad Forgot to commit the actual rule 👎 2015-06-15 17:11:54 -07:00
TJ Horner
ea306038f9 Fix sudo rule 2015-06-15 17:08:08 -07:00
Pablo Santiago Blum de Aguiar
6a88cc47b6 fix(main.wait_output): use Process’ children() instead of get_children()
Since psutil 2.0.0 `get_children()` has become deprecated and the use of
`children()` instead of it has been encouraged. In version 3.0.0, just
released, `get_children()` has been dropped. Check:

https://github.com/giampaolo/psutil/blob/master/HISTORY.rst

Fix #255
2015-06-15 09:59:58 -03:00
Pablo Santiago Blum de Aguiar
96fe1e77b3 refact(rules.no_command): do not add TF_ALIAS to the “callables” list
Fix #234, #245 and #251

Ref #221
2015-06-12 00:49:55 -03:00
Pablo Santiago Blum de Aguiar
c08d9125e4 refact(shells): use an env var TF_ALIAS to keep the name of the alias
This environment variable may be used by any rule to decide whether it
matches or not.
2015-06-10 20:50:49 -03:00
Pablo Santiago Blum de Aguiar
be682170e5 test(shells): add fuck alias to collection of aliases 2015-06-10 20:49:28 -03:00
nvbn
5e981d9b01 Bump to 1.46 2015-06-07 02:24:08 +03:00
nvbn
add499af7f #250 #247 Fix UnicodeDecodeError with fish 2015-06-07 02:23:48 +03:00
nvbn
9c711734aa Merge branch 'encode_fix' of https://github.com/SanketDG/thefuck into SanketDG-encode_fix 2015-06-07 02:13:48 +03:00
Vladimir Iakovlev
ff7a433f39 Merge pull request #249 from mcarton/cargo
Add two cargo related rules
2015-06-07 02:09:11 +03:00
SanketDG
6bb7d79ddc change encoding of return statement to utf8 2015-06-07 00:03:00 +05:30
mcarton
f6c013d033 Add a cargo_no_command rule 2015-06-06 17:22:14 +02:00
mcarton
01cf199866 Add a cargo rule 2015-06-06 17:05:51 +02:00
Vladimir Iakovlev
3d41a3fb7c Merge pull request #246 from cubuspl42/patch-1
Added mount rule
2015-06-04 20:58:24 +03:00
cubuspl42
f55fa35ebf Added mount rule
$ mount /dev/sda2 /mnt/var
mount: only root can do that
2015-06-04 18:38:09 +02:00
nvbn
ce922758a4 Bump to 1.45 2015-06-02 08:47:53 +03:00
Vladimir Iakovlev
c47968a180 Merge pull request #240 from diezcami/brew-upgrade
Added brew_upgrade rule
2015-06-02 08:46:57 +03:00
Vladimir Iakovlev
581c97ec4b Merge pull request #239 from diezcami/quotation-marks
Added quotation_marks rule
2015-06-02 08:46:06 +03:00
Vladimir Iakovlev
0a53966f9b Merge pull request #238 from diezcami/go-run
Added go_run rule
2015-06-02 08:44:56 +03:00
Camille Diez
ed4e7946d7 Updated brew_upgrade description 2015-06-02 13:27:03 +08:00
Cami Diez
2ed96b1d51 Added brew_upgrade rule 2015-06-02 13:23:34 +08:00
Cami Diez
79d94e2651 Added quotation marks rule 2015-06-02 13:18:13 +08:00
Camille Diez
c08182509d Update README.md 2015-06-02 12:08:28 +08:00
Cami Diez
1d2d907c60 Added go_run rule 2015-06-02 12:05:47 +08:00
Vladimir Iakovlev
13996261be Update README.md 2015-06-02 06:11:29 +03:00
Vladimir Iakovlev
afcd7fc67e Merge pull request #237 from waldyrious/patch-1
+how to make the command available right away
2015-06-02 06:10:13 +03:00
Vladimir Iakovlev
c0c7397057 Update README.md 2015-06-02 06:09:45 +03:00
Vladimir Iakovlev
707743e7a7 Merge pull request #236 from bugaevc/git-branch-list
Git branch list
2015-06-02 06:08:09 +03:00
Waldir Pimenta
d8779dc4a6 +how to make the command available right away 2015-06-02 00:57:00 +01:00
Sergey Bugaev
ba9214f7fc Add a test for git_branch_list rule 2015-06-02 00:17:57 +03:00
Sergey Bugaev
660422806c Add git_branch_list rule 2015-06-01 23:52:41 +03:00
Vladimir Iakovlev
3c8978784b Merge pull request #230 from scorphus/git-diff-staged-rule
add(rule): add the new git_diff_staged rule
2015-06-01 08:10:06 +03:00
Vladimir Iakovlev
995b373347 Merge pull request #232 from bugaevc/fix-sudo
Wrap apt-get rule in sudo_support
2015-05-31 01:20:15 +03:00
Sergey Bugaev
dbe1a94c7d Wrap apt-get rule in sudo_support
Fixes sudo_support not working for no_command rule.
2015-05-30 19:40:01 +03:00
Pablo Santiago Blum de Aguiar
15e13d7c1a add(rule): add the new git_diff_staged rule 2015-05-29 18:41:53 -03:00
Vladimir Iakovlev
3194913965 Merge pull request #228 from mcarton/fix-cd-space
Fix cd command
2015-05-29 04:04:02 +03:00
mcarton
237f43ebdb Fix cd command
Fix #226
2015-05-28 23:29:38 +02:00
nvbn
a5aadc6e90 Bump to 1.44 2015-05-28 21:31:10 +03:00
nvbn
18ce062300 Merge branch 'diezcami-java' 2015-05-28 18:03:37 +03:00
nvbn
73bc6c0184 Merge branch 'java' of https://github.com/diezcami/thefuck into diezcami-java
Conflicts:
	README.md
2015-05-28 18:03:24 +03:00
Vladimir Iakovlev
0296a4a46d Merge pull request #227 from Dugucloud/master
Added a sudo string of Fedora's fedup
2015-05-28 18:02:00 +03:00
Vladimir Iakovlev
54a9769c10 Merge pull request #224 from diezcami/javac
Added javac rule
2015-05-28 18:01:14 +03:00
Vladimir Iakovlev
abc7238d14 Merge pull request #219 from scorphus/fix-shell-fish
fix(shell::Fish): avoid looping when calling `fuck` twice
2015-05-28 18:00:42 +03:00
Dugucloud
710a72ee8c Added sudo string for Fedora's fedup 2015-05-28 09:46:41 +08:00
秋纫
e09c6530e5 Merge pull request #3 from nvbn/master
Sync with master
2015-05-28 09:41:18 +08:00
Cami Diez
b1da6a883a Added java rule 2015-05-27 15:50:41 +08:00
Cami Diez
a9e3b22fa4 Added javac rule 2015-05-27 15:47:34 +08:00
Pablo Santiago Blum de Aguiar
9debcdf676 fix(shells::Fish): avoid looping when calling fuck twice
Or whatever the `thefuck` function name is.

Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-27 00:39:47 -03:00
Vladimir Iakovlev
718cadb85a #216 add open rule to readme 2015-05-23 18:49:20 +03:00
Vladimir Iakovlev
910e6f4759 Merge pull request #216 from diezcami/master
Addressed Issue #210
2015-05-23 18:45:52 +03:00
Cami Diez
d3146aa0ac Addressed Issue #210 2015-05-23 23:18:15 +08:00
nvbn
190e47ecdb #215 Use memoize decorator for caching 2015-05-22 17:07:01 +03:00
Vladimir Iakovlev
84a28d8c73 Merge pull request #215 from scorphus/fish-functions
Cache aliases to speed up subsequent calls and add support to Fish functions
2015-05-22 16:55:00 +03:00
Pablo Santiago Blum de Aguiar
551e35e3b6 refact(shells): add support to Fish functions
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-21 23:56:37 -03:00
Pablo Santiago Blum de Aguiar
2bebfabf8d refact(shells): cache aliases to speed up subsequent calls
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-21 23:56:28 -03:00
Vladimir Iakovlev
675317b247 Merge pull request #214 from scorphus/improve-man
refact(man): do not match if there's no argument to man
2015-05-21 15:42:26 +03:00
Pablo Santiago Blum de Aguiar
6cf430cc23 refact(man): do not match if there's no argument to man
If there's no argument to man, a call to thefuck should just give no
fuck.

Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-21 00:00:22 -03:00
nvbn
d088dac0f4 Bump to 1.43 2015-05-21 01:07:41 +03:00
nvbn
c65fdd0f81 Add rule for django south inconsistent migrations 2015-05-21 00:55:23 +03:00
nvbn
e7d7b80c09 Add rule for django south ghost migrations 2015-05-21 00:49:56 +03:00
Vladimir Iakovlev
f986df23d5 Merge pull request #212 from scorphus/fix-whois
fix(whois): check if there's at least one argument to `whois`
2015-05-21 00:33:22 +03:00
Vladimir Iakovlev
cf5f18bf23 Merge pull request #211 from mcarton/man
Add a rule to change man section
2015-05-21 00:32:23 +03:00
Pablo Santiago Blum de Aguiar
44c06c483e fix(whois): check if there's at least one argument to whois
This avoids thefuck failing when there's no arguments. It fails with:

```
  ...
  File "thefuck/rules/whois.py", line 26, in get_new_command
    url = command.script.split()[1]
IndexError: list index out of range
```

Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-20 13:54:33 -03:00
mcarton
1f48d5e12a Add a rule to change man section 2015-05-20 18:08:15 +02:00
nvbn
2c3df1ad47 #209 add support of aliases to no_command 2015-05-20 16:58:05 +03:00
nvbn
5319871326 #209 add get_aliases to shells 2015-05-20 16:56:42 +03:00
nvbn
d6ce5e1e62 #208 .name isn't callable in specific psutil 2015-05-20 16:41:11 +03:00
Vladimir Iakovlev
c42898dde3 Merge pull request #208 from tevino/get-shell-fix
better way to get shell
2015-05-20 16:39:08 +03:00
Tevin Zhang
17b9104939 better way to get shell 2015-05-20 15:30:20 +08:00
nvbn
02d9613618 Bump to 1.42 2015-05-20 02:50:43 +03:00
nvbn
b63ce26853 Reorganize list of rules in readme 2015-05-20 02:50:08 +03:00
nvbn
ce6855fd97 Add git_pull rule 2015-05-20 02:40:36 +03:00
nvbn
051f5fcb89 Bump to 1.41 2015-05-19 15:48:17 +03:00
nvbn
6590da623f #205 Fix import in cd_correction 2015-05-19 15:46:23 +03:00
Vladimir Iakovlev
dc53f58b2a Merge pull request #206 from scorphus/fish-shell
Add support to Fish shell
2015-05-19 12:53:02 +03:00
Vladimir Iakovlev
961d4d5293 Merge pull request #205 from mmussomele/master
Adding cd correction rule to the default rules
2015-05-19 12:52:16 +03:00
Vladimir Iakovlev
1ffc9624ed Merge pull request #202 from mcarton/pacman
Cleanup `pacman` rule
2015-05-19 12:51:26 +03:00
mcarton
afcee5844b Fix pacman tests on Arch Linux 2015-05-18 09:41:49 +02:00
mcarton
881967f4c5 Merge branch 'master' of github.com:nvbn/thefuck into pacman 2015-05-17 20:24:13 +02:00
mmussomele
3c673e0972 fixed extra check 2015-05-17 09:52:42 -07:00
mmussomele
8fdcff776a reimplemented using native string matching 2015-05-17 09:03:19 -07:00
Pablo Santiago Blum de Aguiar
1b5c935f30 feat(shells): add specific actions for the Fish shell
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-17 12:57:45 -03:00
Pablo Santiago Blum de Aguiar
8d256390a1 refact(shells): use os.path.basename to get the name of the shell
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-17 12:57:45 -03:00
Vladimir Iakovlev
51800afca8 Merge pull request #201 from mcarton/whois
Add test and complete README for the `whois` rule
2015-05-17 16:26:23 +03:00
Vladimir Iakovlev
07831666db Merge pull request #200 from scorphus/improve-shells
Improve shells
2015-05-17 16:25:45 +03:00
mmussomele
252859e63a fixed accidentally correcting to some directories with short name length 2015-05-16 23:53:08 -07:00
mmussomele
a54c97f624 added newline to end of cd_correction.py 2015-05-16 21:47:15 -07:00
mmussomele
9ef346468c added cd_correction.py 2015-05-16 21:42:21 -07:00
mcarton
f04c4396eb Fix Python 2.7 support 2015-05-16 23:17:53 +02:00
Pablo Santiago Blum de Aguiar
9ade21bf0a refact(travis): enable verbose mode for tests on travis
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-16 11:53:16 -03:00
Pablo Santiago Blum de Aguiar
179839c32f test(rules): test other rules involving shells.and_()
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-16 11:53:01 -03:00
Pablo Santiago Blum de Aguiar
3d0d4be4a9 refact(shells): add and_ method to assemble expressions involving AND
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-16 11:52:50 -03:00
Pablo Santiago Blum de Aguiar
d854320acc refact(shells): add specific app_alias methods for Bash and Zsh
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-16 11:40:32 -03:00
mcarton
bb4b42d2f1 Add the whois rule in README.md 2015-05-16 15:37:00 +02:00
mcarton
6539c853b4 Add tests for the whois rule 2015-05-16 15:36:27 +02:00
mcarton
5f2b2433b1 Cleanup pacman rule 2015-05-16 15:25:32 +02:00
Vladimir Iakovlev
d41b1d48d2 Merge pull request #199 from igorsantos07/master
Adding rule for forgotten '-r' when grepping folders
2015-05-16 11:51:07 +02:00
Vladimir Iakovlev
bbdac1884a Merge pull request #198 from scorphus/pacman-py2
fix(pacman): make the entire rule py2-compatible
2015-05-16 11:50:36 +02:00
Igor Santos
d5bd57fb49 Adding rule for forgotten '-r' when grepping folders 2015-05-15 19:09:14 -03:00
Pablo Santiago Blum de Aguiar
fc8f1b1136 fix(pacman): make the entire rule py2-compatible
One reference to subprocess.DEVNULL remained.

Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-15 15:53:37 -03:00
Vladimir Iakovlev
d7c67ad09d Merge pull request #197 from mcarton/whois
Add a `whois` rule
2015-05-15 19:13:22 +02:00
Vladimir Iakovlev
73939836d4 Merge pull request #196 from mcarton/no-such-file
Add a `no_such_file` rule
2015-05-15 19:12:43 +02:00
mcarton
744f17d905 Add a whois rule 2015-05-15 18:41:55 +02:00
mcarton
08a2065119 Add missing cases for the no_such_file rule 2015-05-15 18:08:43 +02:00
mcarton
5504aa44a1 Add tests for the no_such_file rule 2015-05-15 18:03:33 +02:00
mcarton
3c4f9d50a9 Add a no_such_file rule 2015-05-15 18:03:17 +02:00
Vladimir Iakovlev
371a4b0ad3 Merge pull request #192 from scorphus/fix-brew-install-py3
Fix brew_install rule on Python 3
2015-05-13 22:54:28 +02:00
Pablo Santiago Blum de Aguiar
9cf41f8e43 fix(brew_install): make subprocess.check_output return str
This fix makes the `brew_install` rule work on Python 3.

Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-13 15:53:30 -03:00
Pablo Santiago Blum de Aguiar
d2e511fa2c refact(brew_install): remove an unused import
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-13 15:53:30 -03:00
Vladimir Iakovlev
a1437db40a Merge pull request #190 from HughMacdonald/master
Add TCSH support
2015-05-13 17:04:17 +02:00
Hugh Macdonald
239f91b670 Update readme 2015-05-13 15:56:50 +01:00
Hugh Macdonald
7b29b54ac7 Add initial tcsh support. Still require better history support 2015-05-13 15:55:33 +01:00
Vladimir Iakovlev
a83d75991b Merge pull request #188 from mcarton/git-stash
Improve the git_stash rule
2015-05-13 11:44:16 +02:00
mcarton
14d14c5ac6 Update README 2015-05-13 09:49:45 +02:00
mcarton
65c624ad52 Improve the git_stash rule 2015-05-13 09:47:31 +02:00
Vladimir Iakovlev
a77db59da5 Merge pull request #187 from mcarton/git-stash
Add a git_stash rule
2015-05-12 20:40:59 +02:00
mcarton
8ac4dafe6d Add a git_stash rule 2015-05-12 19:44:52 +02:00
nvbn
779e29906e Merge branch 'SanketDG-alias_fix' 2015-05-12 14:22:31 +02:00
nvbn
e8de4ee7e8 #185 Fix python 3 2015-05-12 14:22:20 +02:00
nvbn
47a1faa881 Merge branch 'alias_fix' of git://github.com/SanketDG/thefuck into SanketDG-alias_fix 2015-05-12 14:21:35 +02:00
Vladimir Iakovlev
ab97b94faf Merge pull request #183 from scorphus/fix-type-error-py34
fix(brew_unknown_command): make subprocess.check_output return str
2015-05-12 14:20:06 +02:00
SanketDG
7489040f8f fix thefuck-alias 2015-05-12 14:29:00 +05:30
Pablo Santiago Blum de Aguiar
484a53e314 fix(brew_unknown_command): make subprocess.check_output return str
Fix `TypeError: can't concat bytes to str` error on Python 3.4.

Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-05-11 23:58:53 -03:00
nvbn
0fc7c00e8d Bump to 1.40 2015-05-11 14:16:59 +02:00
nvbn
64318c09b7 #161 support different psutils versions 2015-05-11 14:16:23 +02:00
Dugucloud
7e55041963 Merge branch 'master' of https://github.com/nvbn/thefuck 2015-05-10 15:46:06 +08:00
nvbn
5b6e17b5f1 Merge branch 'master' of github.com:nvbn/thefuck 2015-05-10 09:35:44 +02:00
nvbn
6cdc2c27fb #179 /c++1/cpp11/s 2015-05-10 09:35:02 +02:00
nvbn
62c605d0ac Merge branch 'C++11' of git://github.com/mcarton/thefuck into mcarton-C++11 2015-05-10 09:33:49 +02:00
mcarton
8930d01601 Update README.md to add the C++11 rule 2015-05-09 20:42:18 +02:00
mcarton
c749615ad6 Add a C++11 rule 2015-05-09 20:37:13 +02:00
Vladimir Iakovlev
f03d8c54b1 Merge pull request #177 from ja5h/master
Fixed grammar in README.txt
2015-05-09 19:30:20 +02:00
archilius777
20f1c76d27 Fixed grammar in README.txt 2015-05-09 22:56:35 +05:30
nvbn
f477cd69c2 Bump to 1.39 2015-05-09 18:53:49 +02:00
nvbn
690729d5a1 #176 Fix fails with wrong aliases 2015-05-09 18:53:36 +02:00
nvbn
f082ba829f Bump to 1.38 2015-05-08 15:27:33 +02:00
Vladimir Iakovlev
112e20d7c5 Merge pull request #171 from mcarton/dry
Add a don't repeat yourself rule
2015-05-08 12:11:41 +02:00
mcarton
95007220fb Add a test for the DRY rule 2015-05-08 11:42:00 +02:00
mcarton
56f636f3d8 Remove unnecessary space in the DRY rule 2015-05-08 11:41:26 +02:00
mcarton
932a7c5db5 Add a don't repeat yourself rule 2015-05-08 01:49:47 +02:00
Vladimir Iakovlev
1bed4d4e8d Merge pull request #170 from SanketDG/manfix
add rule for having no spaces in man commands.
2015-05-08 01:11:48 +02:00
Vladimir Iakovlev
e0bba379ff Merge pull request #169 from mcarton/git-checkout
Add the git_checkout rule
2015-05-08 01:11:09 +02:00
SanketDG
045959ec47 add man_no_space 2015-05-08 00:16:50 +05:30
SanketDG
65aeea857e add tests for man_no_space 2015-05-08 00:15:57 +05:30
SanketDG
793e883073 add man_no_space command 2015-05-08 00:15:32 +05:30
mcarton
a395ac568c Add the git_checkout rule
It creates a branch before checking-out to it if the branch does not
exist.
2015-05-07 20:32:04 +02:00
nvbn
29e70e14a0 Bump to 1.37 2015-05-07 14:16:17 +02:00
nvbn
0cdd23edcf Use wheel 2015-05-07 14:16:07 +02:00
nvbn
36d80859a4 Add tox config 2015-05-07 13:51:27 +02:00
nvbn
2b12b4bfce Improve tests with mocker 2015-05-07 13:42:52 +02:00
nvbn
91c1fe414a Update thefuck-alias entry point 2015-05-07 13:32:23 +02:00
nvbn
f3d377114e Bump to 1.36 2015-05-07 13:12:25 +02:00
nvbn
05f594b918 #154 Add ability to override priority in settings 2015-05-07 13:11:45 +02:00
nvbn
5bf1424613 #164 Decrease priority of no_command 2015-05-07 12:57:43 +02:00
nvbn
fc3fcf028a #154 Add priority to rules 2015-05-06 13:57:09 +02:00
nvbn
5864faadef #165 fix python 2 support 2015-05-06 13:17:14 +02:00
Vladimir Iakovlev
608d48e408 Merge pull request #166 from mcarton/git-add
Add a git_add rule
2015-05-06 13:10:23 +02:00
mcarton
9380eb1f56 Add a git_add rule 2015-05-06 11:31:31 +02:00
Vladimir Iakovlev
fb069b74d7 Merge pull request #159 from mcarton/master
Add a rule for pacman
2015-05-05 13:30:03 +02:00
mcarton
6624ecb3b8 Add a rule for pacman 2015-05-05 11:13:29 +02:00
nvbn
a8ff2375c0 Bump to 1.35 2015-05-04 05:01:56 +02:00
Vladimir Iakovlev
80bfbec422 Update README.md 2015-05-04 05:00:11 +02:00
nvbn
3f2fe0d275 #89 #152 Use shell history 2015-05-04 04:44:16 +02:00
nvbn
72ac9650f9 Bump to 1.34 2015-05-03 13:25:01 +02:00
nvbn
93c90d5758 #157 Don't fail if can't get brew commands 2015-05-03 13:24:33 +02:00
nvbn
3ce8c1187c Make thefuck-alias depends on current shell 2015-05-03 13:04:33 +02:00
nvbn
bcd3154121 Bump to 1.33 2015-05-03 12:59:37 +02:00
nvbn
fcc2a1a40a #128 #69 add support of shell specific actions, add alias expansion for bash and zsh 2015-05-03 12:46:01 +02:00
nvbn
938f1df035 Remove not used fixture 2015-05-02 04:56:23 +02:00
nvbn
2acfea3350 #1 s/last_script/last_command/, s/last_fixed_script/last_fixed_command/ 2015-05-02 04:32:07 +02:00
nvbn
dd1861955c Refine tests 2015-05-02 04:29:55 +02:00
nvbn
ba601644d6 #1 Add history of last commands, allow fuck more than once 2015-05-01 08:38:38 +02:00
nvbn
fb7376f5a5 Bump to 1.32 2015-05-01 04:47:25 +02:00
nvbn
ee5c40d427 Update rules list in readme 2015-05-01 04:46:58 +02:00
nvbn
9a43ba6e24 #102 Update readme 2015-05-01 04:43:55 +02:00
nvbn
5eeb9d704c #102 Use side_effect in ssh_known_host rule 2015-05-01 04:41:33 +02:00
nvbn
b985dfbffc #102 Add support of rules with side effects 2015-05-01 04:39:37 +02:00
Vladimir Iakovlev
b928a59672 Merge pull request #150 from SanketDG/add-alias
Add thefuck-alias for outputting the alias command.
2015-04-30 20:53:22 +02:00
SanketDG
32fd929e48 add instructions to use thefuck-alias 2015-05-01 00:13:08 +05:30
SanketDG
8a49b40f6a add entry point 2015-05-01 00:12:43 +05:30
SanketDG
4276e1b991 add alias function 2015-05-01 00:12:30 +05:30
nvbn
6372674351 Merge branch 'SanketDG-sudo-shutdown' 2015-04-30 19:57:01 +02:00
nvbn
9f9c5369ec Merge branch 'sudo-shutdown' of https://github.com/SanketDG/thefuck into SanketDG-sudo-shutdown
Conflicts:
	thefuck/rules/sudo.py
2015-04-30 19:56:45 +02:00
Vladimir Iakovlev
50ab7429d9 Merge pull request #148 from danybony/patch-1
Add more patterns to sudo.py
2015-04-30 19:50:59 +02:00
SanketDG
55cfdda203 add rule for shutdown command 2015-04-30 19:50:37 +05:30
Daniele
be9446635b Add more patterns to sudo.py
These patterns cover commands like
`reboot`
or
`dpkg-reconfigure something`
2015-04-30 13:54:02 +01:00
Vladimir Iakovlev
b4cbcd7a99 Merge pull request #146 from kimtree/brew-improve
Improve a logic to get recommended command based on local environment
2015-04-29 08:48:20 +02:00
Namwoo Kim
9bf910a2dd Improve a logic to get recommended command based on local environment 2015-04-29 15:18:48 +09:00
Vladimir Iakovlev
7e76ab1dc6 Fix typo 2015-04-29 05:06:30 +02:00
nvbn
b80f3ea6e4 Bump to 1.31 2015-04-29 05:02:32 +02:00
nvbn
99d9c9aff7 #132 Merge pip_install_sudo rule with sudo rule 2015-04-29 05:01:30 +02:00
nvbn
4be60c78fa Merge branch 'pip-needs-sudo' of https://github.com/kimtree/thefuck into kimtree-pip-needs-sudo 2015-04-29 04:52:09 +02:00
Vladimir Iakovlev
847b9e2cec Merge pull request #143 from SanketDG/readme-fix
add version info to requirements
2015-04-29 04:48:48 +02:00
Vladimir Iakovlev
c463fea8a0 #145 add config examples 2015-04-29 04:47:15 +02:00
SanketDG
7652884df6 change requirements 2015-04-29 00:14:23 +05:30
Vladimir Iakovlev
e1ca120eb8 Merge pull request #137 from Sclarki/patch-1
Added dpkg rule
2015-04-28 20:32:41 +02:00
Trace
d3295e6a4e Hoping this fixes the issue of it not working.
Still new to this project. My problem of it not working (I admit to being at fault) was that I had not added the same rule to the test case.
2015-04-28 11:59:15 -05:00
Namwoo Kim
bc2c87e8fe Add a support for pip install with sudo
- Fixes #136
2015-04-28 15:52:09 +09:00
Trace
a2ac15da56 Added dpkg rule
For example, when using ```dpkg -i some-pkg.deb```
2015-04-27 17:45:59 -05:00
Vladimir Iakovlev
4cf631fa47 Fix links to wiki 2015-04-27 07:56:17 +02:00
Vladimir Iakovlev
cbf6507e1e Move aliases for specific shells to wiki 2015-04-27 07:54:40 +02:00
Vladimir Iakovlev
49ed98c8a4 Move os specific installation to wiki 2015-04-27 07:46:15 +02:00
Vladimir Iakovlev
52bf3907a1 Merge pull request #134 from firstdoit/patch-2
Fix typo: unoffical -> unofficial
2015-04-27 07:30:14 +02:00
Guilherme Rodrigues
077de17d6c Fix typo: unoffical -> unofficial 2015-04-26 20:35:04 -03:00
nvbn
419878f526 #118 Make ls_lah disabled by default 2015-04-25 03:42:36 +02:00
nvbn
f610cf2256 Merge branch 'ls_lah' of git://github.com/crimsonknave/thefuck into crimsonknave-ls_lah 2015-04-25 03:35:53 +02:00
nvbn
2f04a953ba Fix tests with python 2 2015-04-25 03:13:57 +02:00
nvbn
698451f65d Use parametrized tests where it possible 2015-04-25 02:54:39 +02:00
nvbn
b7cb407637 Add useful constructors for Rule and Command for tests 2015-04-25 02:35:26 +02:00
Vladimir Iakovlev
bb6b9a638c #124 Add note that brew package isn't offical 2015-04-25 02:11:07 +02:00
nvbn
0009fb0588 Bump to 1.30 2015-04-25 02:04:38 +02:00
Vladimir Iakovlev
a9d3456e29 Merge pull request #123 from nvbn/revert-117-master
Revert "Fixing fish shell example in README.md"
2015-04-24 18:25:05 +02:00
Vladimir Iakovlev
1e28671934 Revert "Fixing fish shell example in README.md" 2015-04-24 18:24:46 +02:00
Vladimir Iakovlev
3134a60e27 Merge pull request #120 from nwinkler/cd_mkdir
Added cd_mkdir rule
2015-04-24 18:23:22 +02:00
Vladimir Iakovlev
03dd7eda04 Merge pull request #119 from scorphus/initialize-settings
conf: initialize a settings file if it doesn't exist (fix #111)
2015-04-24 18:22:53 +02:00
Nils Winkler
d12a8bcdd8 Added cd_mkdir rule
This fixes #50 and #98.

```bash
$ cd foo/bar/baz
cd: foo: No such file or directory
$ fuck
mkdir -p foo/bar/baz && cd foo/bar/baz
```

Added matchers for both Bash and sh error messages. Depending on your
default shell, the messages might be slightly different.
2015-04-24 08:52:39 +02:00
Pablo Santiago Blum de Aguiar
58069f0a3e conf: initialize a settings file if it doesn't exist (fix #111)
Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2015-04-24 00:38:59 -03:00
nvbn
d0e02bc20c Merge branch 'master' of github.com:nvbn/thefuck 2015-04-24 05:23:04 +02:00
nvbn
e554238996 #78 Disable when can't import CommandNotFound 2015-04-24 05:22:19 +02:00
nvbn
fa465620ba Merge branch 'master' of git://github.com/luv/thefuck 2015-04-24 05:13:37 +02:00
Vladimir Iakovlev
294ba07ce1 Merge pull request #117 from J3RN/master
Fixing fish shell example in README.md
2015-04-24 04:37:27 +02:00
Joseph Henrich
e21befbcc4 add ls_lah to readme 2015-04-23 20:33:38 -04:00
Joseph Henrich
a454438939 Fuck, I wanted ls -lah 2015-04-23 20:28:19 -04:00
Jonathan Arnett
1fa7827f1a Fixing fish shell example in README.md
For me, `$history[1]` is the currently running command, so for the last one you want `$history[2]`
2015-04-23 18:35:18 -04:00
nvbn
48ec853436 Bump to 1.29 2015-04-23 21:50:38 +02:00
nvbn
5a8d889dc0 Merge branch 'master' of github.com:nvbn/thefuck 2015-04-23 21:48:05 +02:00
nvbn
1f96faef2c #116 Fix tests 2015-04-23 21:47:46 +02:00
nvbn
0235c0654d Merge branch 'master' of git://github.com/neomede/thefuck into neomede-master 2015-04-23 21:45:26 +02:00
Vladimir Iakovlev
f286033f82 Merge pull request #114 from nwinkler/fix-alt-space
Added rule for fixing Alt+Space character
2015-04-23 18:07:44 +02:00
Rubén Simón Andreo
473f5e6a33 Add composer rule 2015-04-23 17:34:34 +02:00
Nils Winkler
f1cce413b3 Added rule for fixing Alt+Space character
Happens on the Mac a lot when typing a pipe character (Alt+7), and
keeping the Alt key pressed down for a bit too long, so instead of
Space, you're typing Alt+Space. This rule replaces the Alt+Space with a
simple Space character.

$ ps -ef | grep foo
-bash:  grep: command not found
$ fuck
ps -ef | grep foo
2015-04-23 15:19:30 +02:00
Vladimir Iakovlev
ee2b208adf Merge pull request #112 from nwinkler/eval-alias
Using eval for Bash alias
2015-04-23 15:06:23 +02:00
Vladimir Iakovlev
a20bf6fa23 Merge pull request #110 from kimtree/support-brew
Support brew unknown command
2015-04-23 15:04:18 +02:00
Vladimir Iakovlev
da050f0db3 Merge pull request #109 from bethrezen/patch-1
MacOSX specific message
2015-04-23 15:03:20 +02:00
Vladimir Iakovlev
f5e9124327 Merge pull request #107 from kimtree/support-pip
Add a support for pip unknown commands
2015-04-23 15:02:56 +02:00
Vladimir Iakovlev
1f38e0a932 Merge pull request #106 from Brobin/master
New rule: sl -> ls
2015-04-23 15:01:57 +02:00
Nils Winkler
380827d1d9 Using eval for Bash alias
This fixes #108.
2015-04-23 11:26:19 +02:00
Namwoo Kim
54b5cd6122 Add a support for brew unavailable formulas 2015-04-23 18:16:36 +09:00
Namwoo Kim
9611264210 Update README.md 2015-04-23 17:06:36 +09:00
Namwoo Kim
24ce459f2c Add a support for unknown brew commands - #83 2015-04-23 17:06:05 +09:00
Alexander Kozhevnikov
07b9aba0d0 MacOSX specific message
Patch for understanding macosx message.
Example case:
```
[10:24:48][bethrezen@bethrezen-mac ~]$ apachectl graceful
This operation requires root.
[10:24:54][bethrezen@bethrezen-mac ~]$ fuck
No fuck given
```
2015-04-23 10:29:34 +03:00
Namwoo Kim
bb42780ca5 Update README.md and remove whitespaces 2015-04-23 16:05:02 +09:00
Namwoo Kim
af2bfe7c58 Add a support for pip unknown commands 2015-04-23 15:25:12 +09:00
Brobin
157e3e95fc added sl_ls test :shipit: 2015-04-22 20:51:18 -05:00
Brobin
776ff4e3db updated readme for sl_ls 2015-04-22 20:45:12 -05:00
Brobin
5de020bccd unf*ck sl -> ls 2015-04-22 20:41:56 -05:00
nvbn
0272e8a801 Bump to 1.28 2015-04-22 23:37:02 +02:00
nvbn
2e652112ff Merge branch 'master' of github.com:nvbn/thefuck 2015-04-22 23:36:43 +02:00
Vladimir Iakovlev
12eab10028 Update README.md 2015-04-22 23:08:10 +02:00
Vladimir Iakovlev
61eab83789 Merge pull request #101 from scott-abernethy/brew-install
Brew installation note in README
2015-04-22 23:05:25 +02:00
nvbn
d3d1f99232 Move special data types to types 2015-04-22 23:04:22 +02:00
Scott Abernethy
ca67080bd9 Brew installation note in README 2015-04-23 09:00:18 +12:00
nvbn
54c408a6b5 Rename DEFAULT to DEFAULT_RULES 2015-04-22 22:37:11 +02:00
nvbn
20b6c4c160 Inherit RulesNamesList from list 2015-04-22 22:36:18 +02:00
nvbn
0553d57ec1 Don't mess with inheritance for filling settings 2015-04-22 22:29:23 +02:00
Vladimir Iakovlev
e046d55de8 Merge pull request #99 from timofurrer/master
fix rm dir rule to make it case insensitive
2015-04-22 20:20:00 +02:00
nvbn
69a9516477 Add ability to change settings via environment variables 2015-04-22 20:18:53 +02:00
Timo Furrer
c788dfbc14 fix rm dir rule to make it case insensitive
In bash the output for the command `rm -f foo/` is:

    rm: cannot remove ‘foo/’: Is a directory

And not:

    rm: cannot remove ‘foo/’: is a directory
2015-04-22 19:04:52 +02:00
Dugucloud
fc364b99b9 Revert "Added colorama in requirements.txt"
This reverts commit 742f6f9c94.
2015-04-22 23:18:11 +08:00
nvbn
b4b599df80 Update readme 2015-04-22 16:52:09 +02:00
nvbn
69ddd82bae Bump to 1.27 2015-04-22 16:46:06 +02:00
nvbn
e7b78205f4 Add transparent sudo support for rules where it required 2015-04-22 16:45:38 +02:00
nvbn
7010b3a7f6 #43 Add test for rm_root 2015-04-22 16:22:10 +02:00
nvbn
3a9c2cc204 Merge branch 'SpyCheese-patch-1' 2015-04-22 16:09:09 +02:00
nvbn
fa4e4522b7 #43 Add rm_root as disabled by default rule 2015-04-22 16:08:54 +02:00
nvbn
14ef5c7d1c Merge branch 'patch-1' of git://github.com/SpyCheese/thefuck into SpyCheese-patch-1 2015-04-22 16:03:20 +02:00
nvbn
957209bdb6 Add ability to bundle disabled by default rules 2015-04-22 15:59:44 +02:00
Dugucloud
742f6f9c94 Added colorama in requirements.txt 2015-04-22 21:48:17 +08:00
秋纫
cd1bee9cb0 Merge pull request #2 from nvbn/master
Sync with master
2015-04-22 21:36:07 +08:00
nvbn
8376fed459 Merge branch 'master' of github.com:nvbn/thefuck 2015-04-22 06:03:34 +02:00
nvbn
5d424dad88 Use colorama for colored output 2015-04-22 06:03:06 +02:00
nvbn
126194ec2e Put errors in stderr instead of "echo ..." in stdout 2015-04-22 05:29:44 +02:00
Vladimir Iakovlev
6b54a3a072 Merge pull request #88 from Dugucloud/master
Added sudo rule for Fedora yum's output.
2015-04-22 05:15:24 +02:00
Dugucloud
79fb7c987c Added sudo rule for Fedora yum's output. 2015-04-22 09:26:45 +08:00
秋纫
d2356c570e Merge pull request #1 from nvbn/master
Synchronize with nvbn's repo.
2015-04-22 09:23:20 +08:00
nvbn
d1b1465f4e Bump to 1.26 2015-04-21 22:31:01 +02:00
nvbn
564eb55262 Merge branch 'master' of github.com:nvbn/thefuck 2015-04-21 22:30:38 +02:00
nvbn
20f8a4ad17 Bump to 1.24 2015-04-21 22:30:15 +02:00
Vladimir Iakovlev
a794b58729 Merge pull request #86 from dionyziz/switch_lang_greek
Add Greek to switch lang
2015-04-21 22:19:23 +02:00
nvbn
fdd6144f88 Merge branch 'nicwest-ssh-known-hosts' 2015-04-21 22:11:10 +02:00
nvbn
d1416a6c2a #82 Remove unned print, fix python 3 support 2015-04-21 22:10:53 +02:00
Dionysis Zindros
4f10fe647d Add tests for greek langage 2015-04-21 22:09:48 +02:00
nvbn
3df77b5bad Merge branch 'ssh-known-hosts' of git://github.com/nicwest/thefuck into nicwest-ssh-known-hosts 2015-04-21 22:06:21 +02:00
Vladimir Iakovlev
da013c5c99 Merge pull request #84 from SanketDG/test_cd_parent
Add tests for cd_parent command.
2015-04-21 22:01:57 +02:00
Dionysis Zindros
4b8d4926aa Add Greek to switch lang 2015-04-21 22:00:05 +02:00
SanketDG
2a7cbef3b5 add tests for cd_parent 2015-04-21 23:41:49 +05:30
Nic West
943613a194 add thing for when known hosts have changed 2015-04-21 17:05:52 +01:00
Lukas Vacek
93b6a623e1 adding rule to run "sudo apt-get install" 2015-04-21 17:59:44 +02:00
Vladimir Iakovlev
5b97992d50 Merge pull request #77 from madmatt112/master
Fix spelling mistake
2015-04-21 16:55:39 +02:00
Matthew Field
3f21d5fc3f Fix spelling mistake 2015-04-21 08:47:14 -06:00
Vladimir Iakovlev
d90e093fb7 Merge pull request #75 from installgen2/patch-1
Fix broken settings link in README
2015-04-21 14:53:08 +02:00
Gen2
8e18ff6eab Fix broken settings link in README 2015-04-21 13:46:38 +01:00
nvbn
54d82f9528 Bump version 2015-04-21 14:41:28 +02:00
nvbn
888756d519 #74 Don't fail when rule throws exception 2015-04-21 14:40:52 +02:00
nvbn
d5b4bddc4c #74 Don't fail when runned without args 2015-04-21 14:26:45 +02:00
nvbn
d09238a6e8 Merge branch 'master' of github.com:nvbn/thefuck
Conflicts:
	thefuck/rules/sudo.py
2015-04-21 14:23:31 +02:00
nvbn
c6c3756caf Merge branch 'soheilpro-sudo-rule-root-privilege' 2015-04-21 14:22:34 +02:00
Vladimir Iakovlev
275574beae Merge pull request #73 from Dugucloud/master
Added a string which could be thrown by Fedora's new dnf package manager.
2015-04-21 14:21:53 +02:00
Dugucloud
de4b774134 Added a string which could be thrown by Fedora's new dnf package manager. 2015-04-21 19:43:10 +08:00
Soheil Rashidi
3af5c80d29 Add 'root privilege' pattern to sudo rule. 2015-04-21 12:57:35 +04:30
nvbn
bd5f5045aa #71 Handle iterdir iterator fails 2015-04-21 08:57:35 +02:00
nvbn
798928b5ad #71 Don't fail on non-exists dir in $PATH 2015-04-21 08:45:45 +02:00
nvbn
82e2c89472 Fix version number 2015-04-21 08:40:17 +02:00
nvbn
f2392349f7 #71 Handle OSError more gratefully 2015-04-21 08:38:52 +02:00
SpyCheese
ceeccf1cd7 Update rm_root.py
Okay, there was an incorrect match function.
2015-04-19 10:21:46 +05:00
SpyCheese
f113bae59d Update rm_root.py 2015-04-19 09:12:19 +05:00
SpyCheese
2a79a5e413 Create rm_root.py 2015-04-19 09:03:34 +05:00
363 changed files with 13887 additions and 542 deletions

37
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,37 @@
<!-- If you have any issue with The Fuck, sorry about that, but we will do what we
can to fix that. Actually, maybe we already have, so first thing to do is to
update The Fuck and see if the bug is still there. -->
<!-- If it is (sorry again), check if the problem has not already been reported and
if not, just open an issue on [GitHub](https://github.com/nvbn/thefuck) with
the following basic information: -->
The output of `thefuck --version` (something like `The Fuck 3.1 using Python 3.5.0`):
FILL THIS IN
Your shell and its version (`bash`, `zsh`, *Windows PowerShell*, etc.):
FILL THIS IN
Your system (Debian 7, ArchLinux, Windows, etc.):
<!-- FILL THIS IN -->
How to reproduce the bug:
FILL THIS IN
The output of The Fuck with `THEFUCK_DEBUG=true` exported (typically execute `export THEFUCK_DEBUG=true` in your shell before The Fuck):
FILL THIS IN
If the bug only appears with a specific application, the output of that application and its version:
FILL THIS IN
Anything else you think is relevant:
<!-- FILL THIS IN -->
<!-- It's only with enough information that we can do something to fix the problem. -->

View File

@@ -1,9 +1,45 @@
language: python
python:
- "3.4"
- "3.3"
- "2.7"
sudo: false
matrix:
include:
- os: linux
dist: trusty
python: "3.6"
- os: linux
dist: trusty
python: "3.5"
- os: linux
dist: trusty
python: "3.4"
- os: linux
dist: trusty
python: "2.7"
- os: osx
language: generic
services:
- docker
addons:
apt:
packages:
- python-commandnotfound
- python3-commandnotfound
before_install:
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew update ; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew upgrade python; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then pip3 install virtualenv; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then virtualenv venv -p python3; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then source venv/bin/activate; fi
- pip install -U pip
- pip install -U coveralls
install:
- pip install -Ur requirements.txt
- python setup.py develop
- pip install -r requirements.txt
script: py.test
- rm -rf build
script:
- flake8
- export COVERAGE_PYTHON_VERSION=python-${TRAVIS_PYTHON_VERSION:0:1}
- export RUN_TESTS="coverage run --source=thefuck,tests -m py.test -v --capture=sys tests"
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 && $TRAVIS_OS_NAME != "osx" ]]; then $RUN_TESTS --enable-functional; fi
- if [[ $TRAVIS_PYTHON_VERSION != 3.6 || $TRAVIS_OS_NAME == "osx" ]]; then $RUN_TESTS; fi
after_success:
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 && $TRAVIS_OS_NAME != "osx" ]]; then coveralls; fi

59
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,59 @@
# Report issues
If you have any issue with The Fuck, sorry about that, but we will do what we
can to fix that. Actually, maybe we already have, so first thing to do is to
update The Fuck and see if the bug is still there.
If it is (sorry again), check if the problem has not already been reported and
if not, just open an issue on [GitHub](https://github.com/nvbn/thefuck) with
the following basic information:
- the output of `thefuck --version` (something like `The Fuck 3.1 using
Python 3.5.0`);
- your shell and its version (`bash`, `zsh`, *Windows PowerShell*, etc.);
- your system (Debian 7, ArchLinux, Windows, etc.);
- how to reproduce the bug;
- the output of The Fuck with `THEFUCK_DEBUG=true` exported (typically execute
`export THEFUCK_DEBUG=true` in your shell before The Fuck);
- if the bug only appears with a specific application, the output of that
application and its version;
- anything else you think is relevant.
It's only with enough information that we can do something to fix the problem.
# Make a pull request
We gladly accept pull request on the [official
repository](https://github.com/nvbn/thefuck) for new rules, new features, bug
fixes, etc.
# Developing
Install `The Fuck` for development:
```bash
pip install -r requirements.txt
python setup.py develop
```
Run code style checks:
```bash
flake8
```
Run unit tests:
```bash
py.test
```
Run unit and functional tests (requires docker):
```bash
py.test --enable-functional
```
For sending package to pypi:
```bash
sudo apt-get install pandoc
./release.py
```

View File

@@ -1,7 +1,7 @@
The MIT License (MIT)
=====================
Copyright (c) 2015 Vladimir Iakovlev
Copyright (c) 2015-2018 Vladimir Iakovlev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1 +1,2 @@
include LICENSE.md
include fastentrypoints.py

433
README.md
View File

@@ -1,10 +1,15 @@
# The Fuck [![Build Status](https://travis-ci.org/nvbn/thefuck.svg)](https://travis-ci.org/nvbn/thefuck)
# The Fuck [![Version][version-badge]][version-link] [![Build Status][travis-badge]][travis-link] [![Windows Build Status][appveyor-badge]][appveyor-link] [![Coverage][coverage-badge]][coverage-link] [![MIT License][license-badge]](LICENSE.md)
Magnificent app which corrects your previous console command,
inspired by a [@liamosaur](https://twitter.com/liamosaur/)
[tweet](https://twitter.com/liamosaur/status/506975850596536320).
*The Fuck* is a magnificent app, inspired by a [@liamosaur](https://twitter.com/liamosaur/)
[tweet](https://twitter.com/liamosaur/status/506975850596536320),
that corrects errors in previous console commands.
Few examples:
Is *The Fuck* too slow? [Try the experimental instant mode!](#experimental-instant-mode)
[![gif with examples][examples-link]][examples-link]
More examples:
```bash
➜ apt-get install vim
@@ -12,7 +17,7 @@ E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
➜ fuck
sudo apt-get install vim
sudo apt-get install vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists... Done
...
@@ -27,7 +32,7 @@ To push the current branch and set the remote as upstream, use
➜ fuck
git push --set-upstream origin master
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.
...
```
@@ -40,7 +45,7 @@ No command 'puthon' found, did you mean:
zsh: command not found: puthon
➜ fuck
python
python [enter/↑/↓/ctrl+c]
Python 3.4.2 (default, Oct 8 2014, 13:08:17)
...
```
@@ -50,10 +55,10 @@ Python 3.4.2 (default, Oct 8 2014, 13:08:17)
git: 'brnch' is not a git command. See 'git --help'.
Did you mean this?
branch
branch
➜ fuck
git branch
git branch [enter/↑/↓/ctrl+c]
* master
```
@@ -65,14 +70,14 @@ Did you mean this?
repl
➜ fuck
lein repl
lein repl [enter/↑/↓/ctrl+c]
nREPL server started on port 54848 on host 127.0.0.1 - nrepl://127.0.0.1:54848
REPL-y 0.3.1
...
```
If you are scary to blindly run changed command, there's `require_confirmation`
[settings](#Settings) option:
If you're not afraid of blindly running corrected commands, the
`require_confirmation` [settings](#settings) option can be disabled:
```bash
➜ apt-get install vim
@@ -80,7 +85,7 @@ E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
➜ fuck
sudo apt-get install vim [Enter/Ctrl+C]
sudo apt-get install vim
[sudo] password for nvbn:
Reading package lists... Done
...
@@ -88,127 +93,393 @@ Reading package lists... Done
## Requirements
- python (3.4+)
- pip
- python
- python-dev
## Installation
Install `The Fuck` with `pip`:
On OS X, you can install *The Fuck* via [Homebrew][homebrew]:
```bash
sudo pip install thefuck
brew install thefuck
```
If it fails try to use `easy_install`:
On Ubuntu, install *The Fuck* with the following commands:
```bash
sudo apt update
sudo apt install python3-dev python3-pip
sudo pip3 install thefuck
```
On FreeBSD, install *The Fuck* with the following commands:
```bash
sudo portsnap fetch update
cd /usr/ports/misc/thefuck && sudo make install clean
```
On other systems, install *The Fuck* by using `pip`:
```bash
sudo easy_install thefuck
pip install thefuck
```
And add to `.bashrc` or `.zshrc` or `.bash_profile`(for OSX):
[Alternatively, you may use an OS package manager (OS X, Ubuntu, Arch).](https://github.com/nvbn/thefuck/wiki/Installation)
<a href='#manual-installation' name='manual-installation'>#</a>
It is recommended that you place this command in your `.bash_profile`,
`.bashrc`, `.zshrc` or other startup script:
```bash
alias fuck='$(thefuck $(fc -ln -1))'
# You can use whatever you want as an alias, like for mondays:
alias FUCK='fuck'
eval $(thefuck --alias)
# You can use whatever you want as an alias, like for Mondays:
eval $(thefuck --alias FUCK)
```
Or in `config.fish`:
[Or in your shell config (Bash, Zsh, Fish, Powershell, tcsh).](https://github.com/nvbn/thefuck/wiki/Shell-aliases)
```fish
function fuck
eval (thefuck $history[1])
end
```
Changes are only available in a new shell session. To make changes immediately
available, run `source ~/.bashrc` (or your shell config file like `.zshrc`).
Or in your Powershell `$PROFILE` on Windows:
```powershell
function fuck {
$fuck = $(thefuck (get-history -count 1).commandline)
if($fuck.startswith("echo")) {
$fuck.substring(5)
}
else { iex "$fuck" }
}
```
Changes will be available only in a new shell session.
## Update
To run fixed commands without confirmation, use the `-y` option:
```bash
sudo pip install thefuck --upgrade
fuck -y
```
To fix commands recursively until succeeding, use the `-r` option:
```bash
fuck -r
```
## Updating
```bash
pip3 install thefuck --upgrade
```
**Note: Alias functionality was changed in v1.34 of *The Fuck***
## How it works
The Fuck tries to match rule for the previous command, create new command
using matched rule and run it. Rules enabled by default:
*The Fuck* attempts to match the previous command with a rule. If a match is
found, a new command is created using the matched rule and executed. The
following rules are enabled by default:
* `adb_unknown_command` &ndash; fixes misspelled commands like `adb logcta`;
* `ag_literal` &ndash; adds `-Q` to `ag` when suggested;
* `aws_cli` &ndash; fixes misspelled commands like `aws dynamdb scan`;
* `cargo` &ndash; runs `cargo build` instead of `cargo`;
* `cargo_no_command` &ndash; fixes wrongs commands like `cargo buid`;
* `cd_correction` &ndash; spellchecks and correct failed cd commands;
* `cd_mkdir` &ndash; creates directories before cd'ing into them;
* `cd_parent` &ndash; changes `cd..` to `cd ..`;
* `chmod_x` &ndash; add execution bit;
* `composer_not_command` &ndash; fixes composer command name;
* `cp_omitting_directory` &ndash; adds `-a` when you `cp` directory;
* `git_no_command` &ndash; fixes wrong git commands like `git brnch`;
* `cpp11` &ndash; adds missing `-std=c++11` to `g++` or `clang++`;
* `dirty_untar` &ndash; fixes `tar x` command that untarred in the current directory;
* `dirty_unzip` &ndash; fixes `unzip` command that unzipped in the current directory;
* `django_south_ghost` &ndash; adds `--delete-ghost-migrations` to failed because ghosts django south migration;
* `django_south_merge` &ndash; adds `--merge` to inconsistent django south migration;
* `docker_not_command` &ndash; fixes wrong docker commands like `docker tags`;
* `dry` &ndash; fixes repetitions like `git git push`;
* `fab_command_not_found` &ndash; fix misspelled fabric commands;
* `fix_alt_space` &ndash; replaces Alt+Space with Space character;
* `fix_file` &ndash; opens a file with an error in your `$EDITOR`;
* `gem_unknown_command` &ndash; fixes wrong `gem` commands;
* `git_add` &ndash; fixes *"pathspec 'foo' did not match any file(s) known to git."*;
* `git_add_force` &ndash; adds `--force` to `git add <pathspec>...` when paths are .gitignore'd;
* `git_bisect_usage` &ndash; fixes `git bisect strt`, `git bisect goood`, `git bisect rset`, etc. when bisecting;
* `git_branch_delete` &ndash; changes `git branch -d` to `git branch -D`;
* `git_branch_exists` &ndash; offers `git branch -d foo`, `git branch -D foo` or `git checkout foo` when creating a branch that already exists;
* `git_branch_list` &ndash; catches `git branch list` in place of `git branch` and removes created branch;
* `git_checkout` &ndash; fixes branch name or creates new branch;
* `git_commit_amend` &ndash; offers `git commit --amend` after previous commit;
* `git_diff_no_index` &ndash; adds `--no-index` to previous `git diff` on untracked files;
* `git_diff_staged` &ndash; adds `--staged` to previous `git diff` with unexpected output;
* `git_fix_stash` &ndash; fixes `git stash` commands (misspelled subcommand and missing `save`);
* `git_flag_after_filename` &ndash; fixes `fatal: bad flag '...' after filename`
* `git_help_aliased` &ndash; fixes `git help <alias>` commands replacing <alias> with the aliased command;
* `git_merge` &ndash; adds remote to branch names;
* `git_merge_unrelated` &ndash; adds `--allow-unrelated-histories` when required
* `git_not_command` &ndash; fixes wrong git commands like `git brnch`;
* `git_pull` &ndash; sets upstream before executing previous `git pull`;
* `git_pull_clone` &ndash; clones instead of pulling when the repo does not exist;
* `git_pull_uncommitted_changes` &ndash; stashes changes before pulling and pops them afterwards;
* `git_push` &ndash; adds `--set-upstream origin $branch` to previous failed `git push`;
* `git_push_different_branch_names` &ndash; fixes pushes when local brach name does not match remote branch name;
* `git_push_pull` &ndash; runs `git pull` when `push` was rejected;
* `git_push_without_commits` &ndash; Creates an initial commit if you forget and only `git add .`, when setting up a new project;
* `git_rebase_no_changes` &ndash; runs `git rebase --skip` instead of `git rebase --continue` when there are no changes;
* `git_remote_delete` &ndash; replaces `git remote delete remote_name` with `git remote remove remote_name`;
* `git_rm_local_modifications` &ndash; adds `-f` or `--cached` when you try to `rm` a locally modified file;
* `git_rm_recursive` &ndash; adds `-r` when you try to `rm` a directory;
* `git_rm_staged` &ndash; adds `-f` or `--cached` when you try to `rm` a file with staged changes
* `git_rebase_merge_dir` &ndash; offers `git rebase (--continue | --abort | --skip)` or removing the `.git/rebase-merge` dir when a rebase is in progress;
* `git_remote_seturl_add` &ndash; runs `git remote add` when `git remote set_url` on nonexistant remote;
* `git_stash` &ndash; stashes your local modifications before rebasing or switching branch;
* `git_stash_pop` &ndash; adds your local modifications before popping stash, then resets;
* `git_tag_force` &ndash; adds `--force` to `git tag <tagname>` when the tag already exists;
* `git_two_dashes` &ndash; adds a missing dash to commands like `git commit -amend` or `git rebase -continue`;
* `go_run` &ndash; appends `.go` extension when compiling/running Go programs;
* `gradle_no_task` &ndash; fixes not found or ambiguous `gradle` task;
* `gradle_wrapper` &ndash; replaces `gradle` with `./gradlew`;
* `grep_arguments_order` &ndash; fixes grep arguments order for situations like `grep -lir . test`;
* `grep_recursive` &ndash; adds `-r` when you trying to `grep` directory;
* `grunt_task_not_found` &ndash; fixes misspelled `grunt` commands;
* `gulp_not_task` &ndash; fixes misspelled `gulp` tasks;
* `has_exists_script` &ndash; prepends `./` when script/binary exists;
* `heroku_multiple_apps` &ndash; add `--app <app>` to `heroku` commands like `heroku pg`;
* `heroku_not_command` &ndash; fixes wrong `heroku` commands like `heroku log`;
* `history` &ndash; tries to replace command with most similar command from history;
* `hostscli` &ndash; tries to fix `hostscli` usage;
* `ifconfig_device_not_found` &ndash; fixes wrong device names like `wlan0` to `wlp2s0`;
* `java` &ndash; removes `.java` extension when running Java programs;
* `javac` &ndash; appends missing `.java` when compiling Java files;
* `lein_not_task` &ndash; fixes wrong `lein` tasks like `lein rpl`;
* `ln_no_hard_link` &ndash; catches hard link creation on directories, suggest symbolic link;
* `ln_s_order` &ndash; fixes `ln -s` arguments order;
* `ls_all` &ndash; adds `-A` to `ls` when output is empty;
* `ls_lah` &ndash; adds `-lah` to `ls`;
* `man` &ndash; changes manual section;
* `man_no_space` &ndash; fixes man commands without spaces, for example `mandiff`;
* `mercurial` &ndash; fixes wrong `hg` commands;
* `missing_space_before_subcommand` &ndash; fixes command with missing space like `npminstall`;
* `mkdir_p` &ndash; adds `-p` when you trying to create directory without parent;
* `mvn_no_command` &ndash; adds `clean package` to `mvn`;
* `mvn_unknown_lifecycle_phase` &ndash; fixes misspelled lifecycle phases with `mvn`;
* `npm_missing_script` &ndash; fixes `npm` custom script name in `npm run-script <script>`;
* `npm_run_script` &ndash; adds missing `run-script` for custom `npm` scripts;
* `npm_wrong_command` &ndash; fixes wrong npm commands like `npm urgrade`;
* `no_command` &ndash; fixes wrong console commands, for example `vom/vim`;
* `no_such_file` &ndash; creates missing directories with `mv` and `cp` commands;
* `open` &ndash; either prepends `http://` to address passed to `open` or create a new file or directory and passes it to `open`;
* `pip_unknown_command` &ndash; fixes wrong `pip` commands, for example `pip instatl/pip install`;
* `php_s` &ndash; replaces `-s` by `-S` when trying to run a local php server;
* `port_already_in_use` &ndash; kills process that bound port;
* `prove_recursively` &ndash; adds `-r` when called with directory;
* `python_command` &ndash; prepends `python` when you trying to run not executable/without `./` python script;
* `python_execute` &ndash; appends missing `.py` when executing Python files;
* `quotation_marks` &ndash; fixes uneven usage of `'` and `"` when containing args';
* `path_from_history` &ndash; replaces not found path with similar absolute path from history;
* `react_native_command_unrecognized` &ndash; fixes unrecognized `react-native` commands;
* `remove_trailing_cedilla` &ndash; remove trailling cedillas `ç`, a common typo for european keyboard layouts;
* `rm_dir` &ndash; adds `-rf` when you trying to remove directory;
* `scm_correction` &ndash; corrects wrong scm like `hg log` to `git log`;
* `sed_unterminated_s` &ndash; adds missing '/' to `sed`'s `s` commands;
* `sl_ls` &ndash; changes `sl` to `ls`;
* `ssh_known_hosts` &ndash; removes host from `known_hosts` on warning;
* `sudo` &ndash; prepends `sudo` to previous command if it failed because of permissions;
* `switch_layout` &ndash; switches command from your local layout to en.
* `sudo_command_from_user_path` &ndash; runs commands from users `$PATH` with `sudo`;
* `switch_lang` &ndash; switches command from your local layout to en;
* `systemctl` &ndash; correctly orders parameters of confusing `systemctl`;
* `test.py` &ndash; runs `py.test` instead of `test.py`;
* `touch` &ndash; creates missing directories before "touching";
* `tsuru_login` &ndash; runs `tsuru login` if not authenticated or session expired;
* `tsuru_not_command` &ndash; fixes wrong `tsuru` commands like `tsuru shell`;
* `tmux` &ndash; fixes `tmux` commands;
* `unknown_command` &ndash; fixes hadoop hdfs-style "unknown command", for example adds missing '-' to the command on `hdfs dfs ls`;
* `unsudo` &ndash; removes `sudo` from previous command if a process refuses to run on super user privilege.
* `vagrant_up` &ndash; starts up the vagrant instance;
* `whois` &ndash; fixes `whois` command;
* `workon_doesnt_exists` &ndash; fixes `virtualenvwrapper` env name os suggests to create new.
* `yarn_alias` &ndash; fixes aliased `yarn` commands like `yarn ls`;
* `yarn_command_not_found` &ndash; fixes misspelled `yarn` commands;
* `yarn_command_replaced` &ndash; fixes replaced `yarn` commands;
* `yarn_help` &ndash; makes it easier to open `yarn` documentation;
The following rules are enabled by default on specific platforms only:
* `apt_get` &ndash; installs app from apt if it not installed (requires `python-commandnotfound` / `python3-commandnotfound`);
* `apt_get_search` &ndash; changes trying to search using `apt-get` with searching using `apt-cache`;
* `apt_invalid_operation` &ndash; fixes invalid `apt` and `apt-get` calls, like `apt-get isntall vim`;
* `apt_list_upgradable` &ndash; helps you run `apt list --upgradable` after `apt update`;
* `apt_upgrade` &ndash; helps you run `apt upgrade` after `apt list --upgradable`;
* `brew_cask_dependency` &ndash; installs cask dependencies;
* `brew_install` &ndash; fixes formula name for `brew install`;
* `brew_link` &ndash; adds `--overwrite --dry-run` if linking fails;
* `brew_uninstall` &ndash; adds `--force` to `brew uninstall` if multiple versions were installed;
* `brew_unknown_command` &ndash; fixes wrong brew commands, for example `brew docto/brew doctor`;
* `brew_update_formula` &ndash; turns `brew update <formula>` into `brew upgrade <formula>`;
* `dnf_no_such_command` &ndash; fixes mistyped DNF commands;
* `pacman` &ndash; installs app with `pacman` if it is not installed (uses `yaourt` if available);
* `pacman_not_found` &ndash; fixes package name with `pacman` or `yaourt`.
The following commands are bundled with *The Fuck*, but are not enabled by
default:
* `git_push_force` &ndash; adds `--force-with-lease` to a `git push` (may conflict with `git_push_pull`);
* `rm_root` &ndash; adds `--no-preserve-root` to `rm -rf /` command.
## Creating your own rules
For adding your own rule you should create `your-rule-name.py`
in `~/.thefuck/rules`. Rule should contain two functions:
`match(command: Command, settings: Settings) -> bool`
and `get_new_command(command: Command, settings: Settings) -> str`.
`Command` has three attributes: `script`, `stdout` and `stderr`.
`Settings` is `~/.thefuck/settings.py`.
Simple example of the rule for running script with `sudo`:
To add your own rule, create a file named `your-rule-name.py`
in `~/.config/thefuck/rules`. The rule file must contain two functions:
```python
def match(command, settings):
return ('permission denied' in command.stderr.lower()
or 'EACCES' in command.stderr)
match(command: Command) -> bool
get_new_command(command: Command) -> str | list[str]
```
Additionally, rules can contain optional functions:
```python
side_effect(old_command: Command, fixed_command: str) -> None
```
Rules can also contain the optional variables `enabled_by_default`, `requires_output` and `priority`.
`Command` has three attributes: `script`, `output` and `script_parts`.
Your rule should not change `Command`.
def get_new_command(command, settings):
**Rules api changed in 3.0:** To access a rule's settings, import it with
`from thefuck.conf import settings`
`settings` is a special object assembled from `~/.config/thefuck/settings.py`,
and values from env ([see more below](#settings)).
A simple example rule for running a script with `sudo`:
```python
def match(command):
return ('permission denied' in command.output.lower()
or 'EACCES' in command.output)
def get_new_command(command):
return 'sudo {}'.format(command.script)
# Optional:
enabled_by_default = True
def side_effect(command, fixed_command):
subprocess.call('chmod 777 .', shell=True)
priority = 1000 # Lower first, default is 1000
requires_output = True
```
[More examples of rules](https://github.com/nvbn/thefuck/tree/master/thefuck/rules),
[utility functions for rules](https://github.com/nvbn/thefuck/tree/master/thefuck/utils.py).
[utility functions for rules](https://github.com/nvbn/thefuck/tree/master/thefuck/utils.py),
[app/os-specific helpers](https://github.com/nvbn/thefuck/tree/master/thefuck/specific/).
## Settings
The Fuck has a few settings parameters, they can be changed in `~/.thefuck/settings.py`:
Several *The Fuck* parameters can be changed in the file `$XDG_CONFIG_HOME/thefuck/settings.py`
(`$XDG_CONFIG_HOME` defaults to `~/.config`):
* `rules` &ndash; list of enabled rules, by default all;
* `require_confirmation` &ndash; require confirmation before running new command, by default `False`;
* `wait_command` &ndash; max amount of time in seconds for getting previous command output.
* `rules` &ndash; list of enabled rules, by default `thefuck.conf.DEFAULT_RULES`;
* `exclude_rules` &ndash; list of disabled rules, by default `[]`;
* `require_confirmation` &ndash; requires confirmation before running new command, by default `True`;
* `wait_command` &ndash; max amount of time in seconds for getting previous command output;
* `no_colors` &ndash; disable colored output;
* `priority` &ndash; dict with rules priorities, rule with lower `priority` will be matched first;
* `debug` &ndash; enables debug output, by default `False`;
* `history_limit` &ndash; numeric value of how many history commands will be scanned, like `2000`;
* `alter_history` &ndash; push fixed command to history, by default `True`;
* `wait_slow_command` &ndash; max amount of time in seconds for getting previous command output if it in `slow_commands` list;
* `slow_commands` &ndash; list of slow commands.
An example of `settings.py`:
```python
rules = ['sudo', 'no_command']
exclude_rules = ['git_push']
require_confirmation = True
wait_command = 10
no_colors = False
priority = {'sudo': 100, 'no_command': 9999}
debug = False
history_limit = 9999
wait_slow_command = 20
slow_commands = ['react-native', 'gradle']
```
Or via environment variables:
* `THEFUCK_RULES` &ndash; list of enabled rules, like `DEFAULT_RULES:rm_root` or `sudo:no_command`;
* `THEFUCK_EXCLUDE_RULES` &ndash; list of disabled rules, like `git_pull:git_push`;
* `THEFUCK_REQUIRE_CONFIRMATION` &ndash; require confirmation before running new command, `true/false`;
* `THEFUCK_WAIT_COMMAND` &ndash; max amount of time in seconds for getting previous command output;
* `THEFUCK_NO_COLORS` &ndash; disable colored output, `true/false`;
* `THEFUCK_PRIORITY` &ndash; priority of the rules, like `no_command=9999:apt_get=100`,
rule with lower `priority` will be matched first;
* `THEFUCK_DEBUG` &ndash; enables debug output, `true/false`;
* `THEFUCK_HISTORY_LIMIT` &ndash; how many history commands will be scanned, like `2000`;
* `THEFUCK_ALTER_HISTORY` &ndash; push fixed command to history `true/false`;
* `THEFUCK_WAIT_SLOW_COMMAND` &ndash; max amount of time in seconds for getting previous command output if it in `slow_commands` list;
* `THEFUCK_SLOW_COMMANDS` &ndash; list of slow commands, like `lein:gradle`.
For example:
```bash
export THEFUCK_RULES='sudo:no_command'
export THEFUCK_EXCLUDE_RULES='git_pull:git_push'
export THEFUCK_REQUIRE_CONFIRMATION='true'
export THEFUCK_WAIT_COMMAND=10
export THEFUCK_NO_COLORS='false'
export THEFUCK_PRIORITY='no_command=9999:apt_get=100'
export THEFUCK_HISTORY_LIMIT='2000'
```
## Third-party packages with rules
If you'd like to make a specific set of non-public rules, but would still like
to share them with others, create a package named `thefuck_contrib_*` with
the following structure:
```
thefuck_contrib_foo
thefuck_contrib_foo
rules
__init__.py
*third-party rules*
__init__.py
*third-party-utils*
setup.py
```
*The Fuck* will find rules located in the `rules` module.
## Experimental instant mode
The default behavior of *The Fuck* requires time to re-run previous commands.
When in instant mode, *The Fuck* saves time by logging output with [script](https://en.wikipedia.org/wiki/Script_(Unix)),
then reading the log.
[![gif with instant mode][instant-mode-gif-link]][instant-mode-gif-link]
Currently, instant mode only supports Python 3 with bash or zsh.
To enable instant mode, add `--enable-experimental-instant-mode`
to the alias initialization in `.bashrc`, `.bash_profile` or `.zshrc`.
For example:
```bash
eval $(thefuck --alias --enable-experimental-instant-mode)
```
## Developing
Install `The Fuck` for development:
```bash
pip install -r requirements.txt
python setup.py develop
```
Run tests:
```bash
py.test
```
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License MIT
Project License can be found [here](LICENSE.md).
[version-badge]: https://img.shields.io/pypi/v/thefuck.svg?label=version
[version-link]: https://pypi.python.org/pypi/thefuck/
[travis-badge]: https://travis-ci.org/nvbn/thefuck.svg?branch=master
[travis-link]: https://travis-ci.org/nvbn/thefuck
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/1sskj4imj02um0gu/branch/master?svg=true
[appveyor-link]: https://ci.appveyor.com/project/nvbn/thefuck
[coverage-badge]: https://img.shields.io/coveralls/nvbn/thefuck.svg
[coverage-link]: https://coveralls.io/github/nvbn/thefuck
[license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg
[examples-link]: https://raw.githubusercontent.com/nvbn/thefuck/master/example.gif
[instant-mode-gif-link]: https://raw.githubusercontent.com/nvbn/thefuck/master/example_instant_mode.gif
[homebrew]: http://brew.sh/

23
appveyor.yml Normal file
View File

@@ -0,0 +1,23 @@
build: false
environment:
matrix:
- PYTHON: "C:/Python27"
- PYTHON: "C:/Python34"
- PYTHON: "C:/Python35"
- PYTHON: "C:/Python36"
init:
- "ECHO %PYTHON%"
- ps: "ls C:/Python*"
install:
- "curl -fsS -o C:/get-pip.py https://bootstrap.pypa.io/get-pip.py"
- "%PYTHON%/python.exe C:/get-pip.py"
- "%PYTHON%/Scripts/pip.exe install -U setuptools"
- "%PYTHON%/python.exe setup.py develop"
- "%PYTHON%/Scripts/pip.exe install -U -r requirements.txt"
test_script:
- "%PYTHON%/python.exe -m flake8"
- "%PYTHON%/Scripts/py.test.exe -sv"

BIN
example.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 KiB

BIN
example_instant_mode.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

110
fastentrypoints.py Normal file
View File

@@ -0,0 +1,110 @@
# Copyright (c) 2016, Aaron Christianson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
Monkey patch setuptools to write faster console_scripts with this format:
import sys
from mymodule import entry_function
sys.exit(entry_function())
This is better.
(c) 2016, Aaron Christianson
http://github.com/ninjaaron/fast-entry_points
'''
from setuptools.command import easy_install
import re
TEMPLATE = '''\
# -*- coding: utf-8 -*-
# EASY-INSTALL-ENTRY-SCRIPT: '{3}','{4}','{5}'
__requires__ = '{3}'
import re
import sys
from {0} import {1}
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit({2}())'''
@classmethod
def get_args(cls, dist, header=None):
"""
Yield write_script() argument tuples for a distribution's
console_scripts and gui_scripts entry points.
"""
if header is None:
header = cls.get_header()
spec = str(dist.as_requirement())
for type_ in 'console', 'gui':
group = type_ + '_scripts'
for name, ep in dist.get_entry_map(group).items():
# ensure_safe_name
if re.search(r'[\\/]', name):
raise ValueError("Path separators not allowed in script names")
script_text = TEMPLATE.format(
ep.module_name, ep.attrs[0], '.'.join(ep.attrs),
spec, group, name)
args = cls._get_script_args(type_, name, header, script_text)
for res in args:
yield res
easy_install.ScriptWriter.get_args = get_args
def main():
import os
import re
import shutil
import sys
dests = sys.argv[1:] or ['.']
filename = re.sub('\.pyc$', '.py', __file__)
for dst in dests:
shutil.copy(filename, dst)
manifest_path = os.path.join(dst, 'MANIFEST.in')
setup_path = os.path.join(dst, 'setup.py')
# Insert the include statement to MANIFEST.in if not present
with open(manifest_path, 'a+') as manifest:
manifest.seek(0)
manifest_content = manifest.read()
if not 'include fastentrypoints.py' in manifest_content:
manifest.write(('\n' if manifest_content else '')
+ 'include fastentrypoints.py')
# Insert the import statement to setup.py if not present
with open(setup_path, 'a+') as setup:
setup.seek(0)
setup_content = setup.read()
if not 'import fastentrypoints' in setup_content:
setup.seek(0)
setup.truncate()
setup.write('import fastentrypoints\n' + setup_content)
print(__name__)

4
install.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
echo "Installation script is deprecated!"
echo "For installation instruction please visit https://github.com/nvbn/thefuck"

35
release.py Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python
from subprocess import call
import os
import re
version = None
def get_new_setup_py_lines():
global version
with open('setup.py', 'r') as sf:
current_setup = sf.readlines()
for line in current_setup:
if line.startswith('VERSION = '):
major, minor = re.findall(r"VERSION = '(\d+)\.(\d+)'", line)[0]
version = "{}.{}".format(major, int(minor) + 1)
yield "VERSION = '{}'\n".format(version)
else:
yield line
lines = list(get_new_setup_py_lines())
with open('setup.py', 'w') as sf:
sf.writelines(lines)
call('git pull', shell=True)
call('git commit -am "Bump to {}"'.format(version), shell=True)
call('git tag {}'.format(version), shell=True)
call('git push', shell=True)
call('git push --tags', shell=True)
env = os.environ
env['CONVERT_README'] = 'true'
call('python setup.py sdist bdist_wheel upload', shell=True, env=env)

View File

@@ -1,2 +1,11 @@
pip
flake8
pytest
mock
pytest-mock
wheel
setuptools>=17.1
pexpect
pypandoc
pytest-benchmark
pytest-docker-pexpect

2
setup.cfg Normal file
View File

@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1

49
setup.py Normal file → Executable file
View File

@@ -1,16 +1,57 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
import pkg_resources
import sys
import os
import fastentrypoints
try:
if int(pkg_resources.get_distribution("pip").version.split('.')[0]) < 6:
print('pip older than 6.0 not supported, please upgrade pip with:\n\n'
' pip install -U pip')
sys.exit(-1)
except pkg_resources.DistributionNotFound:
pass
if os.environ.get('CONVERT_README'):
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
else:
long_description = ''
version = sys.version_info[:2]
if version < (2, 7):
print('thefuck requires Python version 2.7 or later' +
' ({}.{} detected).'.format(*version))
sys.exit(-1)
elif (3, 0) < version < (3, 4):
print('thefuck requires Python version 3.4 or later' +
' ({}.{} detected).'.format(*version))
sys.exit(-1)
VERSION = '3.26'
install_requires = ['psutil', 'colorama', 'six', 'decorator', 'pyte']
extras_require = {':python_version<"3.4"': ['pathlib2'],
':python_version<"3.3"': ['backports.shutil_get_terminal_size'],
":sys_platform=='win32'": ['win_unicode_console']}
setup(name='thefuck',
version=1.19,
version=VERSION,
description="Magnificent app which corrects your previous console command",
long_description=long_description,
author='Vladimir Iakovlev',
author_email='nvbn.rm@gmail.com',
url='https://github.com/nvbn/thefuck',
license='MIT',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
packages=find_packages(exclude=['ez_setup', 'examples',
'tests', 'tests.*', 'release']),
include_package_data=True,
zip_safe=False,
install_requires=['pathlib', 'psutil'],
install_requires=install_requires,
extras_require=extras_require,
entry_points={'console_scripts': [
'thefuck = thefuck.main:main']})
'thefuck = thefuck.entrypoints.main:main',
'fuck = thefuck.entrypoints.not_configured:main']})

0
tests/__init__.py Normal file
View File

69
tests/conftest.py Normal file
View File

@@ -0,0 +1,69 @@
import os
import pytest
from thefuck import shells
from thefuck import conf, const
from thefuck.system import Path
shells.shell = shells.Generic()
def pytest_addoption(parser):
"""Adds `--enable-functional` argument."""
group = parser.getgroup("thefuck")
group.addoption('--enable-functional', action="store_true", default=False,
help="Enable functional tests")
@pytest.fixture
def no_memoize(monkeypatch):
monkeypatch.setattr('thefuck.utils.memoize.disabled', True)
@pytest.fixture(autouse=True)
def settings(request):
def _reset_settings():
conf.settings.clear()
conf.settings.update(const.DEFAULT_SETTINGS)
request.addfinalizer(_reset_settings)
conf.settings.user_dir = Path('~/.thefuck')
return conf.settings
@pytest.fixture
def no_colors(settings):
settings.no_colors = True
@pytest.fixture(autouse=True)
def no_cache(monkeypatch):
monkeypatch.setattr('thefuck.utils.cache.disabled', True)
@pytest.fixture(autouse=True)
def functional(request):
if request.node.get_marker('functional') \
and not request.config.getoption('enable_functional'):
pytest.skip('functional tests are disabled')
@pytest.fixture
def source_root():
return Path(__file__).parent.parent.resolve()
@pytest.fixture
def set_shell(monkeypatch):
def _set(cls):
shell = cls()
monkeypatch.setattr('thefuck.shells.shell', shell)
return shell
return _set
@pytest.fixture(autouse=True)
def os_environ(monkeypatch):
env = {'PATH': os.environ['PATH']}
monkeypatch.setattr('os.environ', env)
return env

View File

View File

@@ -0,0 +1,30 @@
from mock import Mock
import pytest
from thefuck.entrypoints.alias import _get_alias
@pytest.mark.parametrize(
'py2, enable_experimental_instant_mode, which, is_instant', [
(False, True, True, True),
(False, False, True, False),
(False, True, False, False),
(True, True, True, False),
(True, True, False, False),
(True, False, True, False)])
def test_get_alias(monkeypatch, mocker, py2,
enable_experimental_instant_mode,
which, is_instant):
monkeypatch.setattr('six.PY2', py2)
args = Mock(
enable_experimental_instant_mode=enable_experimental_instant_mode,
alias='fuck', )
mocker.patch('thefuck.entrypoints.alias.which', return_value=which)
shell = Mock(app_alias=lambda _: 'app_alias',
instant_mode_alias=lambda _: 'instant_mode_alias')
monkeypatch.setattr('thefuck.entrypoints.alias.shell', shell)
alias = _get_alias(args)
if is_instant:
assert alias == 'instant_mode_alias'
else:
assert alias == 'app_alias'

View File

@@ -0,0 +1,26 @@
import pytest
from mock import Mock
from thefuck.entrypoints.fix_command import _get_raw_command
class TestGetRawCommand(object):
def test_from_force_command_argument(self):
known_args = Mock(force_command=['git', 'brunch'])
assert _get_raw_command(known_args) == ['git', 'brunch']
def test_from_command_argument(self, os_environ):
os_environ['TF_HISTORY'] = None
known_args = Mock(force_command=None,
command=['sl'])
assert _get_raw_command(known_args) == ['sl']
@pytest.mark.parametrize('history, result', [
('git br', 'git br'),
('git br\nfcuk', 'git br'),
('git br\nfcuk\nls', 'ls'),
('git br\nfcuk\nls\nfuk', 'ls')])
def test_from_history(self, os_environ, history, result):
os_environ['TF_HISTORY'] = history
known_args = Mock(force_command=None,
command=None)
assert _get_raw_command(known_args) == [result]

View File

@@ -0,0 +1,140 @@
import pytest
import json
from six import StringIO
from mock import MagicMock
from thefuck.shells.generic import ShellConfiguration
from thefuck.entrypoints.not_configured import main
@pytest.fixture(autouse=True)
def usage_tracker(mocker):
return mocker.patch(
'thefuck.entrypoints.not_configured._get_not_configured_usage_tracker_path',
new_callable=MagicMock)
@pytest.fixture(autouse=True)
def usage_tracker_io(usage_tracker):
io = StringIO()
usage_tracker.return_value \
.open.return_value \
.__enter__.return_value = io
return io
@pytest.fixture(autouse=True)
def usage_tracker_exists(usage_tracker):
usage_tracker.return_value \
.exists.return_value = True
return usage_tracker.return_value.exists
def _assert_tracker_updated(usage_tracker_io, pid):
usage_tracker_io.seek(0)
info = json.load(usage_tracker_io)
assert info['pid'] == pid
def _change_tracker(usage_tracker_io, pid):
usage_tracker_io.truncate(0)
info = {'pid': pid, 'time': 0}
json.dump(info, usage_tracker_io)
usage_tracker_io.seek(0)
@pytest.fixture(autouse=True)
def shell_pid(mocker):
return mocker.patch('thefuck.entrypoints.not_configured._get_shell_pid',
new_callable=MagicMock)
@pytest.fixture(autouse=True)
def shell(mocker):
shell = mocker.patch('thefuck.entrypoints.not_configured.shell',
new_callable=MagicMock)
shell.get_history.return_value = []
shell.how_to_configure.return_value = ShellConfiguration(
content='eval $(thefuck --alias)',
path='/tmp/.bashrc',
reload='bash',
can_configure_automatically=True)
return shell
@pytest.fixture(autouse=True)
def shell_config(mocker):
path_mock = mocker.patch('thefuck.entrypoints.not_configured.Path',
new_callable=MagicMock)
return path_mock.return_value \
.expanduser.return_value \
.open.return_value \
.__enter__.return_value
@pytest.fixture(autouse=True)
def logs(mocker):
return mocker.patch('thefuck.entrypoints.not_configured.logs',
new_callable=MagicMock)
def test_for_generic_shell(shell, logs):
shell.how_to_configure.return_value = None
main()
logs.how_to_configure_alias.assert_called_once()
def test_on_first_run(usage_tracker_io, usage_tracker_exists, shell_pid, logs):
shell_pid.return_value = 12
main()
usage_tracker_exists.return_value = False
_assert_tracker_updated(usage_tracker_io, 12)
logs.how_to_configure_alias.assert_called_once()
def test_on_run_after_other_commands(usage_tracker_io, shell_pid, shell, logs):
shell_pid.return_value = 12
shell.get_history.return_value = ['fuck', 'ls']
_change_tracker(usage_tracker_io, 12)
main()
logs.how_to_configure_alias.assert_called_once()
def test_on_first_run_from_current_shell(usage_tracker_io, shell_pid,
shell, logs):
shell.get_history.return_value = ['fuck']
shell_pid.return_value = 12
main()
_assert_tracker_updated(usage_tracker_io, 12)
logs.how_to_configure_alias.assert_called_once()
def test_when_cant_configure_automatically(shell_pid, shell, logs):
shell_pid.return_value = 12
shell.how_to_configure.return_value = ShellConfiguration(
content='eval $(thefuck --alias)',
path='/tmp/.bashrc',
reload='bash',
can_configure_automatically=False)
main()
logs.how_to_configure_alias.assert_called_once()
def test_when_already_configured(usage_tracker_io, shell_pid,
shell, shell_config, logs):
shell.get_history.return_value = ['fuck']
shell_pid.return_value = 12
_change_tracker(usage_tracker_io, 12)
shell_config.read.return_value = 'eval $(thefuck --alias)'
main()
logs.already_configured.assert_called_once()
def test_when_successfully_configured(usage_tracker_io, shell_pid,
shell, shell_config, logs):
shell.get_history.return_value = ['fuck']
shell_pid.return_value = 12
_change_tracker(usage_tracker_io, 12)
shell_config.read.return_value = ''
main()
shell_config.write.assert_any_call('eval $(thefuck --alias)')
logs.configured_successfully.assert_called_once()

View File

85
tests/functional/plots.py Normal file
View File

@@ -0,0 +1,85 @@
def _set_confirmation(proc, require):
proc.sendline(u'mkdir -p ~/.thefuck')
proc.sendline(
u'echo "require_confirmation = {}" > ~/.thefuck/settings.py'.format(
require))
def with_confirmation(proc, TIMEOUT):
"""Ensures that command can be fixed when confirmation enabled."""
_set_confirmation(proc, True)
proc.sendline(u'ehco test')
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u'echo test'])
assert proc.expect([TIMEOUT, u'enter'])
assert proc.expect_exact([TIMEOUT, u'ctrl+c'])
proc.send('\n')
assert proc.expect([TIMEOUT, u'test'])
def history_changed(proc, TIMEOUT, to):
"""Ensures that history changed."""
proc.send('\033[A')
assert proc.expect([TIMEOUT, to])
def history_not_changed(proc, TIMEOUT):
"""Ensures that history not changed."""
proc.send('\033[A')
assert proc.expect([TIMEOUT, u'fuck'])
def select_command_with_arrows(proc, TIMEOUT):
"""Ensures that command can be selected with arrow keys."""
_set_confirmation(proc, True)
proc.sendline(u'git h')
assert proc.expect([TIMEOUT, u"git: 'h' is not a git command."])
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u'git show'])
proc.send('\033[B')
assert proc.expect([TIMEOUT, u'git push'])
proc.send('\033[B')
assert proc.expect([TIMEOUT, u'git help'])
proc.send('\033[A')
assert proc.expect([TIMEOUT, u'git push'])
proc.send('\033[B')
assert proc.expect([TIMEOUT, u'git help'])
proc.send('\n')
assert proc.expect([TIMEOUT, u'usage'])
def refuse_with_confirmation(proc, TIMEOUT):
"""Ensures that fix can be refused when confirmation enabled."""
_set_confirmation(proc, True)
proc.sendline(u'ehco test')
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u'echo test'])
assert proc.expect([TIMEOUT, u'enter'])
assert proc.expect_exact([TIMEOUT, u'ctrl+c'])
proc.send('\003')
assert proc.expect([TIMEOUT, u'Aborted'])
def without_confirmation(proc, TIMEOUT):
"""Ensures that command can be fixed when confirmation disabled."""
_set_confirmation(proc, False)
proc.sendline(u'ehco test')
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u'echo test'])
assert proc.expect([TIMEOUT, u'test'])
def how_to_configure(proc, TIMEOUT):
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u"alias isn't configured"])

View File

@@ -0,0 +1,68 @@
import pytest
from tests.functional.plots import with_confirmation, without_confirmation, \
refuse_with_confirmation, history_changed, history_not_changed, \
select_command_with_arrows, how_to_configure
python_3 = (u'thefuck/python3-bash',
u'FROM python:3',
u'sh')
python_2 = (u'thefuck/python2-bash',
u'FROM python:2',
u'sh')
init_bashrc = u'''echo '
export SHELL=/bin/bash
export PS1="$ "
echo > $HISTFILE
eval $(thefuck --alias {})
echo "instant mode ready: $THEFUCK_INSTANT_MODE"
' > ~/.bashrc'''
@pytest.fixture(params=[(python_3, False),
(python_3, True),
(python_2, False)])
def proc(request, spawnu, TIMEOUT):
container, instant_mode = request.param
proc = spawnu(*container)
proc.sendline(u"pip install /src")
assert proc.expect([TIMEOUT, u'Successfully installed'])
proc.sendline(init_bashrc.format(
u'--enable-experimental-instant-mode' if instant_mode else ''))
proc.sendline(u"bash")
if instant_mode:
assert proc.expect([TIMEOUT, u'instant mode ready: True'])
return proc
@pytest.mark.functional
def test_with_confirmation(proc, TIMEOUT):
with_confirmation(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'echo test')
@pytest.mark.functional
def test_select_command_with_arrows(proc, TIMEOUT):
select_command_with_arrows(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'git help')
@pytest.mark.functional
def test_refuse_with_confirmation(proc, TIMEOUT):
refuse_with_confirmation(proc, TIMEOUT)
history_not_changed(proc, TIMEOUT)
@pytest.mark.functional
def test_without_confirmation(proc, TIMEOUT):
without_confirmation(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'echo test')
@pytest.mark.functional
def test_how_to_configure_alias(proc, TIMEOUT):
proc.sendline('unset -f fuck')
how_to_configure(proc, TIMEOUT)

View File

@@ -0,0 +1,52 @@
import pytest
from tests.functional.plots import with_confirmation, without_confirmation, \
refuse_with_confirmation, select_command_with_arrows
containers = (('thefuck/python3-fish',
u'''FROM python:3
# Use jessie-backports since it has the fish package. See here for details:
# https://github.com/tianon/docker-brew-debian/blob/88ae21052affd8a14553bb969f9d41c464032122/jessie/backports/Dockerfile
RUN awk '$1 ~ "^deb" { $3 = $3 "-backports"; print; exit }' /etc/apt/sources.list > /etc/apt/sources.list.d/backports.list
RUN apt-get update
RUN apt-get install -yy fish''',
u'fish'),
('thefuck/python2-fish',
u'''FROM python:2
# Use jessie-backports since it has the fish package. See here for details:
# https://github.com/tianon/docker-brew-debian/blob/88ae21052affd8a14553bb969f9d41c464032122/jessie/backports/Dockerfile
RUN awk '$1 ~ "^deb" { $3 = $3 "-backports"; print; exit }' /etc/apt/sources.list > /etc/apt/sources.list.d/backports.list
RUN apt-get update
RUN apt-get install -yy fish''',
u'fish'))
@pytest.fixture(params=containers)
def proc(request, spawnu, TIMEOUT):
proc = spawnu(*request.param)
proc.sendline(u"pip install /src")
assert proc.expect([TIMEOUT, u'Successfully installed'])
proc.sendline(u'thefuck --alias > ~/.config/fish/config.fish')
proc.sendline(u'fish')
return proc
@pytest.mark.functional
def test_with_confirmation(proc, TIMEOUT):
with_confirmation(proc, TIMEOUT)
@pytest.mark.functional
def test_select_command_with_arrows(proc, TIMEOUT):
select_command_with_arrows(proc, TIMEOUT)
@pytest.mark.functional
def test_refuse_with_confirmation(proc, TIMEOUT):
refuse_with_confirmation(proc, TIMEOUT)
@pytest.mark.functional
def test_without_confirmation(proc, TIMEOUT):
without_confirmation(proc, TIMEOUT)
# TODO: ensure that history changes.

View File

@@ -0,0 +1,45 @@
import pytest
import time
dockerfile = u'''
FROM python:3
RUN adduser --disabled-password --gecos '' test
ENV SEED "{seed}"
WORKDIR /src
USER test
RUN echo 'eval $(thefuck --alias)' > /home/test/.bashrc
RUN echo > /home/test/.bash_history
RUN git config --global user.email "you@example.com"
RUN git config --global user.name "Your Name"
USER root
'''.format(seed=time.time())
def plot(proc, TIMEOUT):
proc.sendline(u'cd /home/test/')
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u'No fucks given'])
proc.sendline(u'git init')
proc.sendline(u'git add .')
proc.sendline(u'git commit -a -m init')
proc.sendline(u'git brnch')
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u'git branch'])
proc.send('\n')
assert proc.expect([TIMEOUT, u'master'])
proc.sendline(u'echo test')
proc.sendline(u'echo tst')
proc.sendline(u'fuck')
assert proc.expect([TIMEOUT, u'echo test'])
proc.send('\n')
assert proc.expect([TIMEOUT, u'test'])
@pytest.mark.functional
@pytest.mark.benchmark(min_rounds=10)
def test_performance(spawnu, TIMEOUT, benchmark):
proc = spawnu(u'thefuck/python3-bash-performance',
dockerfile, u'bash')
proc.sendline(u'pip install /src')
proc.sendline(u'su test')
assert benchmark(plot, proc, TIMEOUT) is None

View File

@@ -0,0 +1,47 @@
import pytest
from tests.functional.plots import with_confirmation, without_confirmation, \
refuse_with_confirmation, select_command_with_arrows
containers = (('thefuck/python3-tcsh',
u'''FROM python:3
RUN apt-get update
RUN apt-get install -yy tcsh''',
u'tcsh'),
('thefuck/python2-tcsh',
u'''FROM python:2
RUN apt-get update
RUN apt-get install -yy tcsh''',
u'tcsh'))
@pytest.fixture(params=containers)
def proc(request, spawnu, TIMEOUT):
proc = spawnu(*request.param)
proc.sendline(u'pip install /src')
assert proc.expect([TIMEOUT, u'Successfully installed'])
proc.sendline(u'tcsh')
proc.sendline(u'setenv PYTHONIOENCODING utf8')
proc.sendline(u'eval `thefuck --alias`')
return proc
@pytest.mark.functional
def test_with_confirmation(proc, TIMEOUT):
with_confirmation(proc, TIMEOUT)
@pytest.mark.functional
def test_select_command_with_arrows(proc, TIMEOUT):
select_command_with_arrows(proc, TIMEOUT)
@pytest.mark.functional
def test_refuse_with_confirmation(proc, TIMEOUT):
refuse_with_confirmation(proc, TIMEOUT)
@pytest.mark.functional
def test_without_confirmation(proc, TIMEOUT):
without_confirmation(proc, TIMEOUT)
# TODO: ensure that history changes.

View File

@@ -0,0 +1,75 @@
import pytest
from tests.functional.plots import with_confirmation, without_confirmation, \
refuse_with_confirmation, history_changed, history_not_changed, \
select_command_with_arrows, how_to_configure
python_3 = ('thefuck/python3-zsh',
u'''FROM python:3
RUN apt-get update
RUN apt-get install -yy zsh''',
u'sh')
python_2 = ('thefuck/python2-zsh',
u'''FROM python:2
RUN apt-get update
RUN apt-get install -yy zsh''',
u'sh')
init_zshrc = u'''echo '
export SHELL=/usr/bin/zsh
export HISTFILE=~/.zsh_history
echo > $HISTFILE
export SAVEHIST=100
export HISTSIZE=100
eval $(thefuck --alias {})
setopt INC_APPEND_HISTORY
echo "instant mode ready: $THEFUCK_INSTANT_MODE"
' > ~/.zshrc'''
@pytest.fixture(params=[(python_3, False),
(python_3, True),
(python_2, False)])
def proc(request, spawnu, TIMEOUT):
container, instant_mode = request.param
proc = spawnu(*container)
proc.sendline(u'pip install /src')
assert proc.expect([TIMEOUT, u'Successfully installed'])
proc.sendline(init_zshrc.format(
u'--enable-experimental-instant-mode' if instant_mode else ''))
proc.sendline(u"zsh")
if instant_mode:
assert proc.expect([TIMEOUT, u'instant mode ready: True'])
return proc
@pytest.mark.functional
def test_with_confirmation(proc, TIMEOUT):
with_confirmation(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'echo test')
@pytest.mark.functional
def test_select_command_with_arrows(proc, TIMEOUT):
select_command_with_arrows(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'git help')
@pytest.mark.functional
def test_refuse_with_confirmation(proc, TIMEOUT):
refuse_with_confirmation(proc, TIMEOUT)
history_not_changed(proc, TIMEOUT)
@pytest.mark.functional
def test_without_confirmation(proc, TIMEOUT):
without_confirmation(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'echo test')
@pytest.mark.functional
def test_how_to_configure_alias(proc, TIMEOUT):
proc.sendline(u'unfunction fuck')
how_to_configure(proc, TIMEOUT)

0
tests/rules/__init__.py Normal file
View File

View File

@@ -0,0 +1,41 @@
import pytest
from thefuck.rules.adb_unknown_command import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''Android Debug Bridge version 1.0.31
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <specific device> - directs command to the device or emulator with the given
serial number or qualifier. Overrides ANDROID_SERIAL
environment variable.
'''
@pytest.mark.parametrize('script', [
('adb lgcat'),
('adb puhs')])
def test_match(output, script):
assert match(Command(script, output))
@pytest.mark.parametrize('script', [
'git branch foo',
'abd push'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, new_command', [
('adb puhs test.bin /sdcard/test.bin', 'adb push test.bin /sdcard/test.bin'),
('adb -s 1111 logcta', 'adb -s 1111 logcat'),
('adb -P 666 pulll /sdcard/test.bin', 'adb -P 666 pull /sdcard/test.bin'),
('adb -d logcatt', 'adb -d logcat'),
('adb -e reboott', 'adb -e reboot')])
def test_get_new_command(script, output, new_command):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,25 @@
import pytest
from thefuck.rules.ag_literal import get_new_command, match
from thefuck.types import Command
@pytest.fixture
def output():
return ('ERR: Bad regex! pcre_compile() failed at position 1: missing )\n'
'If you meant to search for a literal string, run ag with -Q\n')
@pytest.mark.parametrize('script', ['ag \('])
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize('script', ['ag foo'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, new_cmd', [
('ag \(', 'ag -Q \(')])
def test_get_new_command(script, new_cmd, output):
assert get_new_command((Command(script, output))) == new_cmd

View File

@@ -0,0 +1,53 @@
import pytest
from thefuck.rules.apt_get import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command, packages', [
(Command('vim', 'vim: command not found'),
[('vim', 'main'), ('vim-tiny', 'main')]),
(Command('sudo vim', 'vim: command not found'),
[('vim', 'main'), ('vim-tiny', 'main')]),
(Command('vim', "The program 'vim' is currently not installed. You can install it by typing: sudo apt install vim"),
[('vim', 'main'), ('vim-tiny', 'main')])])
def test_match(mocker, command, packages):
mocker.patch('thefuck.rules.apt_get.which', return_value=None)
mocker.patch('thefuck.rules.apt_get._get_packages',
create=True, return_value=packages)
assert match(command)
@pytest.mark.parametrize('command, packages, which', [
(Command('a_bad_cmd', 'a_bad_cmd: command not found'),
[], None),
(Command('vim', ''), [], None),
(Command('', ''), [], None),
(Command('vim', 'vim: command not found'),
['vim'], '/usr/bin/vim'),
(Command('sudo vim', 'vim: command not found'),
['vim'], '/usr/bin/vim')])
def test_not_match(mocker, command, packages, which):
mocker.patch('thefuck.rules.apt_get.which', return_value=which)
mocker.patch('thefuck.rules.apt_get._get_packages',
create=True, return_value=packages)
assert not match(command)
@pytest.mark.parametrize('command, new_command, packages', [
(Command('vim', ''), 'sudo apt-get install vim && vim',
[('vim', 'main'), ('vim-tiny', 'main')]),
(Command('convert', ''), 'sudo apt-get install imagemagick && convert',
[('imagemagick', 'main'),
('graphicsmagick-imagemagick-compat', 'universe')]),
(Command('sudo vim', ''), 'sudo apt-get install vim && sudo vim',
[('vim', 'main'), ('vim-tiny', 'main')]),
(Command('sudo convert', ''), 'sudo apt-get install imagemagick && sudo convert',
[('imagemagick', 'main'),
('graphicsmagick-imagemagick-compat', 'universe')])])
def test_get_new_command(mocker, command, new_command, packages):
mocker.patch('thefuck.rules.apt_get._get_packages',
create=True, return_value=packages)
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,26 @@
import pytest
from thefuck.rules.apt_get_search import get_new_command, match
from thefuck.types import Command
def test_match():
assert match(Command('apt-get search foo', ''))
@pytest.mark.parametrize('command', [
Command('apt-cache search foo', ''),
Command('aptitude search foo', ''),
Command('apt search foo', ''),
Command('apt-get install foo', ''),
Command('apt-get source foo', ''),
Command('apt-get clean', ''),
Command('apt-get remove', ''),
Command('apt-get update', '')
])
def test_not_match(command):
assert not match(command)
def test_get_new_command():
new_command = get_new_command(Command('apt-get search foo', ''))
assert new_command == 'apt-cache search foo'

View File

@@ -0,0 +1,122 @@
from io import BytesIO
import pytest
from thefuck.types import Command
from thefuck.rules.apt_invalid_operation import match, get_new_command, \
_get_operations
invalid_operation = 'E: Invalid operation {}'.format
apt_help = b'''apt 1.0.10.2ubuntu1 for amd64 compiled on Oct 5 2015 15:55:05
Usage: apt [options] command
CLI for apt.
Basic commands:
list - list packages based on package names
search - search in package descriptions
show - show package details
update - update list of available packages
install - install packages
remove - remove packages
upgrade - upgrade the system by installing/upgrading packages
full-upgrade - upgrade the system by removing/installing/upgrading packages
edit-sources - edit the source information file
'''
apt_operations = ['list', 'search', 'show', 'update', 'install', 'remove',
'upgrade', 'full-upgrade', 'edit-sources']
apt_get_help = b'''apt 1.0.10.2ubuntu1 for amd64 compiled on Oct 5 2015 15:55:05
Usage: apt-get [options] command
apt-get [options] install|remove pkg1 [pkg2 ...]
apt-get [options] source pkg1 [pkg2 ...]
apt-get is a simple command line interface for downloading and
installing packages. The most frequently used commands are update
and install.
Commands:
update - Retrieve new lists of packages
upgrade - Perform an upgrade
install - Install new packages (pkg is libc6 not libc6.deb)
remove - Remove packages
autoremove - Remove automatically all unused packages
purge - Remove packages and config files
source - Download source archives
build-dep - Configure build-dependencies for source packages
dist-upgrade - Distribution upgrade, see apt-get(8)
dselect-upgrade - Follow dselect selections
clean - Erase downloaded archive files
autoclean - Erase old downloaded archive files
check - Verify that there are no broken dependencies
changelog - Download and display the changelog for the given package
download - Download the binary package into the current directory
Options:
-h This help text.
-q Loggable output - no progress indicator
-qq No output except for errors
-d Download only - do NOT install or unpack archives
-s No-act. Perform ordering simulation
-y Assume Yes to all queries and do not prompt
-f Attempt to correct a system with broken dependencies in place
-m Attempt to continue if archives are unlocatable
-u Show a list of upgraded packages as well
-b Build the source package after fetching it
-V Show verbose version numbers
-c=? Read this configuration file
-o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp
See the apt-get(8), sources.list(5) and apt.conf(5) manual
pages for more information and options.
This APT has Super Cow Powers.
'''
apt_get_operations = ['update', 'upgrade', 'install', 'remove', 'autoremove',
'purge', 'source', 'build-dep', 'dist-upgrade',
'dselect-upgrade', 'clean', 'autoclean', 'check',
'changelog', 'download']
@pytest.mark.parametrize('script, output', [
('apt', invalid_operation('saerch')),
('apt-get', invalid_operation('isntall')),
('apt-cache', invalid_operation('rumove'))])
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize('script, output', [
('vim', invalid_operation('vim')),
('apt-get', "")])
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.fixture
def set_help(mocker):
mock = mocker.patch('subprocess.Popen')
def _set_text(text):
mock.return_value.stdout = BytesIO(text)
return _set_text
@pytest.mark.parametrize('app, help_text, operations', [
('apt', apt_help, apt_operations),
('apt-get', apt_get_help, apt_get_operations)
])
def test_get_operations(set_help, app, help_text, operations):
set_help(help_text)
assert _get_operations(app) == operations
@pytest.mark.parametrize('script, output, help_text, result', [
('apt-get isntall vim', invalid_operation('isntall'),
apt_get_help, 'apt-get install vim'),
('apt saerch vim', invalid_operation('saerch'),
apt_help, 'apt search vim'),
])
def test_get_new_command(set_help, output, script, help_text, result):
set_help(help_text)
assert get_new_command(Command(script, output))[0] == result

View File

@@ -0,0 +1,75 @@
import pytest
from thefuck.rules.apt_list_upgradable import get_new_command, match
from thefuck.types import Command
match_output = '''
Hit:1 http://us.archive.ubuntu.com/ubuntu zesty InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu zesty-updates InRelease
Get:3 http://us.archive.ubuntu.com/ubuntu zesty-backports InRelease [89.2 kB]
Hit:4 http://security.ubuntu.com/ubuntu zesty-security InRelease
Hit:5 http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu zesty InRelease
Hit:6 https://download.docker.com/linux/ubuntu zesty InRelease
Hit:7 https://cli-assets.heroku.com/branches/stable/apt ./ InRelease
Fetched 89.2 kB in 0s (122 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
8 packages can be upgraded. Run 'apt list --upgradable' to see them.
'''
no_match_output = '''
Hit:1 http://us.archive.ubuntu.com/ubuntu zesty InRelease
Get:2 http://us.archive.ubuntu.com/ubuntu zesty-updates InRelease [89.2 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu zesty-backports InRelease [89.2 kB]
Get:4 http://security.ubuntu.com/ubuntu zesty-security InRelease [89.2 kB]
Hit:5 https://cli-assets.heroku.com/branches/stable/apt ./ InRelease
Hit:6 http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu zesty InRelease
Hit:7 https://download.docker.com/linux/ubuntu zesty InRelease
Get:8 http://us.archive.ubuntu.com/ubuntu zesty-updates/main i386 Packages [232 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu zesty-updates/main amd64 Packages [235 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu zesty-updates/main amd64 DEP-11 Metadata [55.2 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu zesty-updates/main DEP-11 64x64 Icons [32.3 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu zesty-updates/universe amd64 Packages [156 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu zesty-updates/universe i386 Packages [156 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu zesty-updates/universe amd64 DEP-11 Metadata [175 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu zesty-updates/universe DEP-11 64x64 Icons [253 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu zesty-updates/multiverse amd64 DEP-11 Metadata [5,840 B]
Get:17 http://us.archive.ubuntu.com/ubuntu zesty-backports/universe amd64 DEP-11 Metadata [4,588 B]
Get:18 http://security.ubuntu.com/ubuntu zesty-security/main amd64 DEP-11 Metadata [12.7 kB]
Get:19 http://security.ubuntu.com/ubuntu zesty-security/main DEP-11 64x64 Icons [17.6 kB]
Get:20 http://security.ubuntu.com/ubuntu zesty-security/universe amd64 DEP-11 Metadata [21.6 kB]
Get:21 http://security.ubuntu.com/ubuntu zesty-security/universe DEP-11 64x64 Icons [47.7 kB]
Get:22 http://security.ubuntu.com/ubuntu zesty-security/multiverse amd64 DEP-11 Metadata [208 B]
Fetched 1,673 kB in 0s (1,716 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
'''
def test_match():
assert match(Command('sudo apt update', match_output))
@pytest.mark.parametrize('command', [
Command('apt-cache search foo', ''),
Command('aptitude search foo', ''),
Command('apt search foo', ''),
Command('apt-get install foo', ''),
Command('apt-get source foo', ''),
Command('apt-get clean', ''),
Command('apt-get remove', ''),
Command('apt-get update', ''),
Command('sudo apt update', no_match_output)
])
def test_not_match(command):
assert not match(command)
def test_get_new_command():
new_command = get_new_command(Command('sudo apt update', match_output))
assert new_command == 'sudo apt list --upgradable'
new_command = get_new_command(Command('apt update', match_output))
assert new_command == 'apt list --upgradable'

View File

@@ -0,0 +1,36 @@
import pytest
from thefuck.rules.apt_upgrade import get_new_command, match
from thefuck.types import Command
match_output = '''
Listing... Done
heroku/stable 6.15.2-1 amd64 [upgradable from: 6.14.43-1]
resolvconf/zesty-updates,zesty-updates 1.79ubuntu4.1 all [upgradable from: 1.79ubuntu4]
squashfs-tools/zesty-updates 1:4.3-3ubuntu2.17.04.1 amd64 [upgradable from: 1:4.3-3ubuntu2]
unattended-upgrades/zesty-updates,zesty-updates 0.93.1ubuntu2.4 all [upgradable from: 0.93.1ubuntu2.3]
'''
no_match_output = '''
Listing... Done
'''
def test_match():
assert match(Command('apt list --upgradable', match_output))
assert match(Command('sudo apt list --upgradable', match_output))
@pytest.mark.parametrize('command', [
Command('apt list --upgradable', no_match_output),
Command('sudo apt list --upgradable', no_match_output)
])
def test_not_match(command):
assert not match(command)
def test_get_new_command():
new_command = get_new_command(Command('apt list --upgradable', match_output))
assert new_command == 'apt upgrade'
new_command = get_new_command(Command('sudo apt list --upgradable', match_output))
assert new_command == 'sudo apt upgrade'

101
tests/rules/test_aws_cli.py Normal file
View File

@@ -0,0 +1,101 @@
import pytest
from thefuck.rules.aws_cli import match, get_new_command
from thefuck.types import Command
no_suggestions = '''\
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument command: Invalid choice, valid choices are:
dynamodb | dynamodbstreams
ec2 | ecr
'''
misspelled_command = '''\
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument command: Invalid choice, valid choices are:
dynamodb | dynamodbstreams
ec2 | ecr
Invalid choice: 'dynamdb', maybe you meant:
* dynamodb
'''
misspelled_subcommand = '''\
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
query | scan
update-item | update-table
Invalid choice: 'scn', maybe you meant:
* scan
'''
misspelled_subcommand_with_multiple_options = '''\
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
describe-table | get-item
list-tables | put-item
Invalid choice: 't-item', maybe you meant:
* put-item
* get-item
'''
@pytest.mark.parametrize('command', [
Command('aws dynamdb scan', misspelled_command),
Command('aws dynamodb scn', misspelled_subcommand),
Command('aws dynamodb t-item',
misspelled_subcommand_with_multiple_options)])
def test_match(command):
assert match(command)
def test_not_match():
assert not match(Command('aws dynamodb invalid', no_suggestions))
@pytest.mark.parametrize('command, result', [
(Command('aws dynamdb scan', misspelled_command),
['aws dynamodb scan']),
(Command('aws dynamodb scn', misspelled_subcommand),
['aws dynamodb scan']),
(Command('aws dynamodb t-item',
misspelled_subcommand_with_multiple_options),
['aws dynamodb put-item', 'aws dynamodb get-item'])])
def test_get_new_command(command, result):
assert get_new_command(command) == result

View File

@@ -0,0 +1,35 @@
import pytest
from thefuck.rules.brew_cask_dependency import match, get_new_command
from thefuck.types import Command
output = '''sshfs: OsxfuseRequirement unsatisfied!
You can install with Homebrew-Cask:
brew cask install osxfuse
You can download from:
https://osxfuse.github.io/
Error: An unsatisfied requirement failed this build.'''
def test_match():
command = Command('brew install sshfs', output)
assert match(command)
@pytest.mark.parametrize('script, output', [
('brew link sshfs', output),
('cat output', output),
('brew install sshfs', '')])
def test_not_match(script, output):
command = Command(script, output)
assert not match(command)
@pytest.mark.parametrize('before, after', [
('brew install sshfs',
'brew cask install osxfuse && brew install sshfs')])
def test_get_new_command(before, after):
command = Command(before, output)
assert get_new_command(command) == after

View File

@@ -0,0 +1,46 @@
import pytest
from thefuck.rules.brew_install import match, get_new_command
from thefuck.rules.brew_install import _get_formulas
from thefuck.types import Command
@pytest.fixture
def brew_no_available_formula():
return '''Error: No available formula for elsticsearch '''
@pytest.fixture
def brew_install_no_argument():
return '''This command requires a formula argument'''
@pytest.fixture
def brew_already_installed():
return '''Warning: git-2.3.5 already installed'''
def _is_not_okay_to_test():
return 'elasticsearch' not in _get_formulas()
@pytest.mark.skipif(_is_not_okay_to_test(),
reason='No need to run if there\'s no formula')
def test_match(brew_no_available_formula, brew_already_installed,
brew_install_no_argument):
assert match(Command('brew install elsticsearch',
brew_no_available_formula))
assert not match(Command('brew install git',
brew_already_installed))
assert not match(Command('brew install', brew_install_no_argument))
@pytest.mark.skipif(_is_not_okay_to_test(),
reason='No need to run if there\'s no formula')
def test_get_new_command(brew_no_available_formula):
assert get_new_command(Command('brew install elsticsearch',
brew_no_available_formula))\
== 'brew install elasticsearch'
assert get_new_command(Command('brew install aa',
brew_no_available_formula))\
!= 'brew install aha'

View File

@@ -0,0 +1,37 @@
import pytest
from thefuck.types import Command
from thefuck.rules.brew_link import get_new_command, match
@pytest.fixture
def output():
return ("Error: Could not symlink bin/gcp\n"
"Target /usr/local/bin/gcp\n"
"already exists. You may want to remove it:\n"
" rm '/usr/local/bin/gcp'\n"
"\n"
"To force the link and overwrite all conflicting files:\n"
" brew link --overwrite coreutils\n"
"\n"
"To list all files that would be deleted:\n"
" brew link --overwrite --dry-run coreutils\n")
@pytest.fixture
def new_command(formula):
return 'brew link --overwrite --dry-run {}'.format(formula)
@pytest.mark.parametrize('script', ['brew link coreutils', 'brew ln coreutils'])
def test_match(output, script):
assert match(Command(script, output))
@pytest.mark.parametrize('script', ['brew link coreutils'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, formula, ', [('brew link coreutils', 'coreutils')])
def test_get_new_command(output, new_command, script, formula):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,31 @@
import pytest
from thefuck.types import Command
from thefuck.rules.brew_uninstall import get_new_command, match
@pytest.fixture
def output():
return ("Uninstalling /usr/local/Cellar/tbb/4.4-20160916... (118 files, 1.9M)\n"
"tbb 4.4-20160526, 4.4-20160722 are still installed.\n"
"Remove all versions with `brew uninstall --force tbb`.\n")
@pytest.fixture
def new_command(formula):
return 'brew uninstall --force {}'.format(formula)
@pytest.mark.parametrize('script', ['brew uninstall tbb', 'brew rm tbb', 'brew remove tbb'])
def test_match(output, script):
assert match(Command(script, output))
@pytest.mark.parametrize('script', ['brew remove gnuplot'])
def test_not_match(script):
output = 'Uninstalling /usr/local/Cellar/gnuplot/5.0.4_1... (44 files, 2.3M)\n'
assert not match(Command(script, output))
@pytest.mark.parametrize('script, formula, ', [('brew uninstall tbb', 'tbb')])
def test_get_new_command(output, new_command, script, formula):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,29 @@
import pytest
from thefuck.rules.brew_unknown_command import match, get_new_command
from thefuck.rules.brew_unknown_command import _brew_commands
from thefuck.types import Command
@pytest.fixture
def brew_unknown_cmd():
return '''Error: Unknown command: inst'''
@pytest.fixture
def brew_unknown_cmd2():
return '''Error: Unknown command: instaa'''
def test_match(brew_unknown_cmd):
assert match(Command('brew inst', brew_unknown_cmd))
for command in _brew_commands():
assert not match(Command('brew ' + command, ''))
def test_get_new_command(brew_unknown_cmd, brew_unknown_cmd2):
assert (get_new_command(Command('brew inst', brew_unknown_cmd))
== ['brew list', 'brew install', 'brew uninstall'])
cmds = get_new_command(Command('brew instaa', brew_unknown_cmd2))
assert 'brew install' in cmds
assert 'brew uninstall' in cmds

View File

@@ -0,0 +1,28 @@
import pytest
from thefuck.types import Command
from thefuck.rules.brew_update_formula import get_new_command, match
output = ("Error: This command updates brew itself, and does not take formula"
" names.\nUse 'brew upgrade thefuck'.")
def test_match():
command = Command('brew update thefuck', output)
assert match(command)
@pytest.mark.parametrize('script', [
'brew upgrade foo',
'brew update'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, formula, ', [
('brew update foo', 'foo'),
('brew update bar zap', 'bar zap')])
def test_get_new_command(script, formula):
command = Command(script, output)
new_command = 'brew upgrade {}'.format(formula)
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,28 @@
import pytest
from thefuck.rules.cargo_no_command import match, get_new_command
from thefuck.types import Command
no_such_subcommand_old = """No such subcommand
Did you mean `build`?
"""
no_such_subcommand = """error: no such subcommand
\tDid you mean `build`?
"""
@pytest.mark.parametrize('command', [
Command('cargo buid', no_such_subcommand_old),
Command('cargo buils', no_such_subcommand)])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('cargo buid', no_such_subcommand_old), 'cargo build'),
(Command('cargo buils', no_such_subcommand), 'cargo build')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,23 @@
import pytest
from thefuck.rules.cd_correction import match
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('cd foo', 'cd: foo: No such file or directory'),
Command('cd foo/bar/baz',
'cd: foo: No such file or directory'),
Command('cd foo/bar/baz', 'cd: can\'t cd to foo/bar/baz'),
Command('cd /foo/bar/', 'cd: The directory "/foo/bar/" does not exist')])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('cd foo', ''), Command('', '')])
def test_not_match(command):
assert not match(command)
# Note that get_new_command uses local filesystem, so not testing it here.
# Instead, see the functional test `functional.test_cd_correction`

View File

@@ -0,0 +1,26 @@
import pytest
from thefuck.rules.cd_mkdir import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('cd foo', 'cd: foo: No such file or directory'),
Command('cd foo/bar/baz',
'cd: foo: No such file or directory'),
Command('cd foo/bar/baz', 'cd: can\'t cd to foo/bar/baz'),
Command('cd /foo/bar/', 'cd: The directory "/foo/bar/" does not exist')])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('cd foo', ''), Command('', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('cd foo', ''), 'mkdir -p foo && cd foo'),
(Command('cd foo/bar/baz', ''), 'mkdir -p foo/bar/baz && cd foo/bar/baz')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,11 @@
from thefuck.rules.cd_parent import match, get_new_command
from thefuck.types import Command
def test_match():
assert match(Command('cd..', 'cd..: command not found'))
assert not match(Command('', ''))
def test_get_new_command():
assert get_new_command(Command('cd..', '')) == 'cd ..'

View File

@@ -0,0 +1,39 @@
import pytest
from thefuck.types import Command
from thefuck.rules.chmod_x import match, get_new_command
@pytest.fixture
def file_exists(mocker):
return mocker.patch('os.path.exists', return_value=True)
@pytest.fixture
def file_access(mocker):
return mocker.patch('os.access', return_value=False)
@pytest.mark.usefixtures('file_exists', 'file_access')
@pytest.mark.parametrize('script, output', [
('./gradlew build', 'gradlew: Permission denied'),
('./install.sh --help', 'install.sh: permission denied')])
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize('script, output, exists, callable', [
('./gradlew build', 'gradlew: Permission denied', True, True),
('./gradlew build', 'gradlew: Permission denied', False, False),
('./gradlew build', 'gradlew: error', True, False),
('gradlew build', 'gradlew: Permission denied', True, False)])
def test_not_match(file_exists, file_access, script, output, exists, callable):
file_exists.return_value = exists
file_access.return_value = callable
assert not match(Command(script, output))
@pytest.mark.parametrize('script, result', [
('./gradlew build', 'chmod +x gradlew && ./gradlew build'),
('./install.sh --help', 'chmod +x install.sh && ./install.sh --help')])
def test_get_new_command(script, result):
assert get_new_command(Command(script, '')) == result

View File

@@ -0,0 +1,56 @@
import pytest
from thefuck.rules.composer_not_command import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def composer_not_command():
# that weird spacing is part of the actual command output
return (
'\n'
'\n'
' \n'
' [InvalidArgumentException] \n'
' Command "udpate" is not defined. \n'
' Did you mean this? \n'
' update \n'
' \n'
'\n'
'\n'
)
@pytest.fixture
def composer_not_command_one_of_this():
# that weird spacing is part of the actual command output
return (
'\n'
'\n'
' \n'
' [InvalidArgumentException] \n'
' Command "pdate" is not defined. \n'
' Did you mean one of these? \n'
' selfupdate \n'
' self-update \n'
' update \n'
' \n'
'\n'
'\n'
)
def test_match(composer_not_command, composer_not_command_one_of_this):
assert match(Command('composer udpate',
composer_not_command))
assert match(Command('composer pdate',
composer_not_command_one_of_this))
assert not match(Command('ls update', composer_not_command))
def test_get_new_command(composer_not_command, composer_not_command_one_of_this):
assert (get_new_command(Command('composer udpate',
composer_not_command))
== 'composer update')
assert (get_new_command(Command('composer pdate',
composer_not_command_one_of_this))
== 'composer selfupdate')

View File

@@ -1,14 +1,22 @@
from mock import Mock
import pytest
from thefuck.rules.cp_omitting_directory import match, get_new_command
from thefuck.types import Command
def test_match():
assert match(Mock(script='cp dir', stderr="cp: omitting directory 'dir'"),
None)
assert not match(Mock(script='some dir',
stderr="cp: omitting directory 'dir'"), None)
assert not match(Mock(script='cp dir', stderr=""), None)
@pytest.mark.parametrize('script, output', [
('cp dir', 'cp: dor: is a directory'),
('cp dir', "cp: omitting directory 'dir'")])
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize('script, output', [
('some dir', 'cp: dor: is a directory'),
('some dir', "cp: omitting directory 'dir'"),
('cp dir', '')])
def test_not_match(script, output):
assert not match(Command(script, output))
def test_get_new_command():
assert get_new_command(Mock(script='cp dir'), None) == 'cp -a dir'
assert get_new_command(Command('cp dir', '')) == 'cp -a dir'

View File

@@ -0,0 +1,73 @@
import os
import pytest
import tarfile
from thefuck.rules.dirty_untar import match, get_new_command, side_effect, \
tar_extensions # noqa: E126
from thefuck.types import Command
@pytest.fixture
def tar_error(tmpdir):
def fixture(filename):
path = os.path.join(str(tmpdir), filename)
def reset(path):
os.mkdir('d')
with tarfile.TarFile(path, 'w') as archive:
for file in ('a', 'b', 'c', 'd/e'):
with open(file, 'w') as f:
f.write('*')
archive.add(file)
os.remove(file)
with tarfile.TarFile(path, 'r') as archive:
archive.extractall()
os.chdir(str(tmpdir))
reset(path)
assert set(os.listdir('.')) == {filename, 'a', 'b', 'c', 'd'}
assert set(os.listdir('./d')) == {'e'}
return fixture
parametrize_extensions = pytest.mark.parametrize('ext', tar_extensions)
# (filename as typed by the user, unquoted filename, quoted filename as per shells.quote)
parametrize_filename = pytest.mark.parametrize('filename, unquoted, quoted', [
('foo{}', 'foo{}', 'foo{}'),
('"foo bar{}"', 'foo bar{}', "'foo bar{}'")])
parametrize_script = pytest.mark.parametrize('script, fixed', [
('tar xvf {}', 'mkdir -p {dir} && tar xvf {filename} -C {dir}'),
('tar -xvf {}', 'mkdir -p {dir} && tar -xvf {filename} -C {dir}'),
('tar --extract -f {}', 'mkdir -p {dir} && tar --extract -f {filename} -C {dir}')])
@parametrize_extensions
@parametrize_filename
@parametrize_script
def test_match(ext, tar_error, filename, unquoted, quoted, script, fixed):
tar_error(unquoted.format(ext))
assert match(Command(script.format(filename.format(ext)), ''))
@parametrize_extensions
@parametrize_filename
@parametrize_script
def test_side_effect(ext, tar_error, filename, unquoted, quoted, script, fixed):
tar_error(unquoted.format(ext))
side_effect(Command(script.format(filename.format(ext)), ''), None)
assert set(os.listdir('.')) == {unquoted.format(ext), 'd'}
@parametrize_extensions
@parametrize_filename
@parametrize_script
def test_get_new_command(ext, tar_error, filename, unquoted, quoted, script, fixed):
tar_error(unquoted.format(ext))
assert (get_new_command(Command(script.format(filename.format(ext)), ''))
== fixed.format(dir=quoted.format(''), filename=filename.format(ext)))

View File

@@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
import os
import pytest
import zipfile
from thefuck.rules.dirty_unzip import match, get_new_command, side_effect
from thefuck.types import Command
from unicodedata import normalize
@pytest.fixture
def zip_error(tmpdir):
def zip_error_inner(filename):
path = os.path.join(str(tmpdir), filename)
def reset(path):
with zipfile.ZipFile(path, 'w') as archive:
archive.writestr('a', '1')
archive.writestr('b', '2')
archive.writestr('c', '3')
archive.writestr('d/e', '4')
archive.extractall()
os.chdir(str(tmpdir))
reset(path)
dir_list = os.listdir(u'.')
if filename not in dir_list:
filename = normalize('NFD', filename)
assert set(dir_list) == {filename, 'a', 'b', 'c', 'd'}
assert set(os.listdir('./d')) == {'e'}
return zip_error_inner
@pytest.mark.parametrize('script,filename', [
(u'unzip café', u'café.zip'),
(u'unzip café.zip', u'café.zip'),
(u'unzip foo', u'foo.zip'),
(u'unzip foo.zip', u'foo.zip')])
def test_match(zip_error, script, filename):
zip_error(filename)
assert match(Command(script, ''))
@pytest.mark.parametrize('script,filename', [
(u'unzip café', u'café.zip'),
(u'unzip café.zip', u'café.zip'),
(u'unzip foo', u'foo.zip'),
(u'unzip foo.zip', u'foo.zip')])
def test_side_effect(zip_error, script, filename):
zip_error(filename)
side_effect(Command(script, ''), None)
dir_list = os.listdir(u'.')
if filename not in set(dir_list):
filename = normalize('NFD', filename)
assert set(dir_list) == {filename, 'd'}
@pytest.mark.parametrize('script,fixed,filename', [
(u'unzip café', u"unzip café -d 'café'", u'café.zip'),
(u'unzip foo', u'unzip foo -d foo', u'foo.zip'),
(u"unzip 'foo bar.zip'", u"unzip 'foo bar.zip' -d 'foo bar'", u'foo.zip'),
(u'unzip foo.zip', u'unzip foo.zip -d foo', u'foo.zip')])
def test_get_new_command(zip_error, script, fixed, filename):
zip_error(filename)
assert get_new_command(Command(script, '')) == fixed

View File

@@ -0,0 +1,53 @@
import pytest
from thefuck.rules.django_south_ghost import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''Traceback (most recent call last):
File "/home/nvbn/work/.../bin/python", line 42, in <module>
exec(compile(__file__f.read(), __file__, "exec"))
File "/home/nvbn/work/.../app/manage.py", line 34, in <module>
execute_from_command_line(sys.argv)
File "/home/nvbn/work/.../lib/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/home/nvbn/work/.../lib/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/nvbn/work/.../lib/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/nvbn/work/.../lib/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/home/nvbn/work/.../app/lib/south/management/commands/migrate.py", line 108, in handle
ignore_ghosts = ignore_ghosts,
File "/home/nvbn/work/.../app/lib/south/migration/__init__.py", line 193, in migrate_app
applied_all = check_migration_histories(applied_all, delete_ghosts, ignore_ghosts)
File "/home/nvbn/work/.../app/lib/south/migration/__init__.py", line 88, in check_migration_histories
raise exceptions.GhostMigrations(ghosts)
south.exceptions.GhostMigrations:
! These migrations are in the database but not on disk:
<app1: 0033_auto__...>
<app1: 0034_fill_...>
<app1: 0035_rename_...>
<app2: 0003_add_...>
<app2: 0004_denormalize_...>
<app1: 0033_auto....>
<app1: 0034_fill...>
! I'm not trusting myself; either fix this yourself by fiddling
! with the south_migrationhistory table, or pass --delete-ghost-migrations
! to South to have it delete ALL of these records (this may not be good).
''' # noqa
def test_match(output):
assert match(Command('./manage.py migrate', output))
assert match(Command('python manage.py migrate', output))
assert not match(Command('./manage.py migrate', ''))
assert not match(Command('app migrate', output))
assert not match(Command('./manage.py test', output))
def test_get_new_command():
assert get_new_command(Command('./manage.py migrate auth', ''))\
== './manage.py migrate auth --delete-ghost-migrations'

View File

@@ -0,0 +1,43 @@
import pytest
from thefuck.rules.django_south_merge import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''Running migrations for app:
! Migration app:0003_auto... should not have been applied before app:0002_auto__add_field_query_due_date_ but was.
Traceback (most recent call last):
File "/home/nvbn/work/.../bin/python", line 42, in <module>
exec(compile(__file__f.read(), __file__, "exec"))
File "/home/nvbn/work/.../app/manage.py", line 34, in <module>
execute_from_command_line(sys.argv)
File "/home/nvbn/work/.../lib/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/home/nvbn/work/.../lib/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/nvbn/work/.../lib/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/nvbn/work/.../lib/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/home/nvbn/work/.../app/lib/south/management/commands/migrate.py", line 108, in handle
ignore_ghosts = ignore_ghosts,
File "/home/nvbn/work/.../app/lib/south/migration/__init__.py", line 207, in migrate_app
raise exceptions.InconsistentMigrationHistory(problems)
south.exceptions.InconsistentMigrationHistory: Inconsistent migration history
The following options are available:
--merge: will just attempt the migration ignoring any potential dependency conflicts.
'''
def test_match(output):
assert match(Command('./manage.py migrate', output))
assert match(Command('python manage.py migrate', output))
assert not match(Command('./manage.py migrate', ''))
assert not match(Command('app migrate', output))
assert not match(Command('./manage.py test', output))
def test_get_new_command():
assert (get_new_command(Command('./manage.py migrate auth', ''))
== './manage.py migrate auth --merge')

View File

@@ -0,0 +1,190 @@
from io import BytesIO
import pytest
from thefuck.types import Command
from thefuck.rules.dnf_no_such_command import match, get_new_command, _get_operations
help_text = b'''usage: dnf [options] COMMAND
List of Main Commands:
autoremove remove all unneeded packages that were originally installed as dependencies
check check for problems in the packagedb
check-update check for available package upgrades
clean remove cached data
deplist List package's dependencies and what packages provide them
distro-sync synchronize installed packages to the latest available versions
downgrade Downgrade a package
group display, or use, the groups information
help display a helpful usage message
history display, or use, the transaction history
info display details about a package or group of packages
install install a package or packages on your system
list list a package or groups of packages
makecache generate the metadata cache
mark mark or unmark installed packages as installed by user.
provides find what package provides the given value
reinstall reinstall a package
remove remove a package or packages from your system
repolist display the configured software repositories
repoquery search for packages matching keyword
repository-packages run commands on top of all packages in given repository
search search package details for the given string
shell run an interactive DNF shell
swap run an interactive dnf mod for remove and install one spec
updateinfo display advisories about packages
upgrade upgrade a package or packages on your system
upgrade-minimal upgrade, but only 'newest' package match which fixes a problem that affects your system
List of Plugin Commands:
builddep Install build dependencies for package or spec file
config-manager manage dnf configuration options and repositories
copr Interact with Copr repositories.
debug-dump dump information about installed rpm packages to file
debug-restore restore packages recorded in debug-dump file
debuginfo-install install debuginfo packages
download Download package to current directory
needs-restarting determine updated binaries that need restarting
playground Interact with Playground repository.
repoclosure Display a list of unresolved dependencies for repositories
repograph Output a full package dependency graph in dot format
repomanage Manage a directory of rpm packages
reposync download all packages from remote repo
Optional arguments:
-c [config file], --config [config file]
config file location
-q, --quiet quiet operation
-v, --verbose verbose operation
--version show DNF version and exit
--installroot [path] set install root
--nodocs do not install documentations
--noplugins disable all plugins
--enableplugin [plugin]
enable plugins by name
--disableplugin [plugin]
disable plugins by name
--releasever RELEASEVER
override the value of $releasever in config and repo
files
--setopt SETOPTS set arbitrary config and repo options
--skip-broken resolve depsolve problems by skipping packages
-h, --help, --help-cmd
show command help
--allowerasing allow erasing of installed packages to resolve
dependencies
-b, --best try the best available package versions in
transactions.
-C, --cacheonly run entirely from system cache, don't update cache
-R [minutes], --randomwait [minutes]
maximum command wait time
-d [debug level], --debuglevel [debug level]
debugging output level
--debugsolver dumps detailed solving results into files
--showduplicates show duplicates, in repos, in list/search commands
-e ERRORLEVEL, --errorlevel ERRORLEVEL
error output level
--obsoletes enables dnf's obsoletes processing logic for upgrade
or display capabilities that the package obsoletes for
info, list and repoquery
--rpmverbosity [debug level name]
debugging output level for rpm
-y, --assumeyes automatically answer yes for all questions
--assumeno automatically answer no for all questions
--enablerepo [repo]
--disablerepo [repo]
--repo [repo], --repoid [repo]
enable just specific repositories by an id or a glob,
can be specified multiple times
-x [package], --exclude [package], --excludepkgs [package]
exclude packages by name or glob
--disableexcludes [repo], --disableexcludepkgs [repo]
disable excludepkgs
--repofrompath [repo,path]
label and path to additional repository, can be
specified multiple times.
--noautoremove disable removal of dependencies that are no longer
used
--nogpgcheck disable gpg signature checking
--color COLOR control whether colour is used
--refresh set metadata as expired before running the command
-4 resolve to IPv4 addresses only
-6 resolve to IPv6 addresses only
--destdir DESTDIR, --downloaddir DESTDIR
set directory to copy packages to
--downloadonly only download packages
--bugfix Include bugfix relevant packages, in updates
--enhancement Include enhancement relevant packages, in updates
--newpackage Include newpackage relevant packages, in updates
--security Include security relevant packages, in updates
--advisory ADVISORY, --advisories ADVISORY
Include packages needed to fix the given advisory, in
updates
--bzs BUGZILLA Include packages needed to fix the given BZ, in
updates
--cves CVES Include packages needed to fix the given CVE, in
updates
--sec-severity {Critical,Important,Moderate,Low}, --secseverity {Critical,Important,Moderate,Low}
Include security relevant packages matching the
severity, in updates
--forcearch ARCH Force the use of an architecture
'''
dnf_operations = ['autoremove', 'check', 'check-update', 'clean', 'deplist',
'distro-sync', 'downgrade', 'group', 'help', 'history',
'info', 'install', 'list', 'makecache', 'mark', 'provides',
'reinstall', 'remove', 'repolist', 'repoquery',
'repository-packages', 'search', 'shell', 'swap', 'updateinfo',
'upgrade', 'upgrade-minimal', 'builddep', 'config-manager',
'copr', 'debug-dump', 'debug-restore', 'debuginfo-install',
'download', 'needs-restarting', 'playground', 'repoclosure',
'repograph', 'repomanage', 'reposync']
def invalid_command(command):
return """No such command: %s. Please use /usr/bin/dnf --help
It could be a DNF plugin command, try: "dnf install 'dnf-command(%s)'"
""" % (command, command)
@pytest.mark.parametrize('output', [
(invalid_command('saerch')),
(invalid_command('isntall'))
])
def test_match(output):
assert match(Command('dnf', output))
@pytest.mark.parametrize('script, output', [
('pip', invalid_command('isntall')),
('vim', "")
])
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.fixture
def set_help(mocker):
mock = mocker.patch('subprocess.Popen')
def _set_text(text):
mock.return_value.stdout = BytesIO(text)
return _set_text
def test_get_operations(set_help):
set_help(help_text)
assert _get_operations() == dnf_operations
@pytest.mark.parametrize('script, output, result', [
('dnf isntall vim', invalid_command('isntall'),
'dnf install vim'),
('dnf saerch vim', invalid_command('saerch'),
'dnf search vim'),
])
def test_get_new_command(set_help, output, script, result):
set_help(help_text)
assert result in get_new_command(Command(script, output))

View File

@@ -0,0 +1,129 @@
import pytest
from io import BytesIO
from thefuck.types import Command
from thefuck.rules.docker_not_command import get_new_command, match
@pytest.fixture
def docker_help(mocker):
help = b'''Usage: docker [OPTIONS] COMMAND [arg...]
A self-sufficient runtime for linux containers.
Options:
--api-cors-header= Set CORS headers in the remote API
-b, --bridge= Attach containers to a network bridge
--bip= Specify network bridge IP
-D, --debug=false Enable debug mode
-d, --daemon=false Enable daemon mode
--default-gateway= Container default gateway IPv4 address
--default-gateway-v6= Container default gateway IPv6 address
--default-ulimit=[] Set default ulimits for containers
--dns=[] DNS server to use
--dns-search=[] DNS search domains to use
-e, --exec-driver=native Exec driver to use
--exec-opt=[] Set exec driver options
--exec-root=/var/run/docker Root of the Docker execdriver
--fixed-cidr= IPv4 subnet for fixed IPs
--fixed-cidr-v6= IPv6 subnet for fixed IPs
-G, --group=docker Group for the unix socket
-g, --graph=/var/lib/docker Root of the Docker runtime
-H, --host=[] Daemon socket(s) to connect to
-h, --help=false Print usage
--icc=true Enable inter-container communication
--insecure-registry=[] Enable insecure registry communication
--ip=0.0.0.0 Default IP when binding container ports
--ip-forward=true Enable net.ipv4.ip_forward
--ip-masq=true Enable IP masquerading
--iptables=true Enable addition of iptables rules
--ipv6=false Enable IPv6 networking
-l, --log-level=info Set the logging level
--label=[] Set key=value labels to the daemon
--log-driver=json-file Default driver for container logs
--log-opt=map[] Set log driver options
--mtu=0 Set the containers network MTU
-p, --pidfile=/var/run/docker.pid Path to use for daemon PID file
--registry-mirror=[] Preferred Docker registry mirror
-s, --storage-driver= Storage driver to use
--selinux-enabled=false Enable selinux support
--storage-opt=[] Set storage driver options
--tls=false Use TLS; implied by --tlsverify
--tlscacert=~/.docker/ca.pem Trust certs signed only by this CA
--tlscert=~/.docker/cert.pem Path to TLS certificate file
--tlskey=~/.docker/key.pem Path to TLS key file
--tlsverify=false Use TLS and verify the remote
--userland-proxy=true Use userland proxy for loopback traffic
-v, --version=false Print version information and quit
Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders from a container's filesystem to the host path
create Create a new container
diff Inspect changes on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Stream the contents of a container as a tar archive
history Show the history of an image
images List images
import Create a new filesystem image from the contents of a tarball
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive
login Register or log in to a Docker registry server
logout Log out from a Docker registry server
logs Fetch the logs of a container
pause Pause all processes within a container
port Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
ps List containers
pull Pull an image or a repository from a Docker registry server
push Push an image or a repository to a Docker registry server
rename Rename an existing container
restart Restart a running container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image to a tar archive
search Search for an image on the Docker Hub
start Start a stopped container
stats Display a stream of a containers' resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Lookup the running processes of a container
unpause Unpause a paused container
version Show the Docker version information
wait Block until a container stops, then print its exit code
Run 'docker COMMAND --help' for more information on a command.
'''
mock = mocker.patch('subprocess.Popen')
mock.return_value.stdout = BytesIO(help)
return mock
def output(cmd):
return "docker: '{}' is not a docker command.\n" \
"See 'docker --help'.".format(cmd)
def test_match():
assert match(Command('docker pes', output('pes')))
@pytest.mark.parametrize('script, output', [
('docker ps', ''),
('cat pes', output('pes'))])
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.mark.usefixtures('docker_help')
@pytest.mark.parametrize('wrong, fixed', [
('pes', ['ps', 'push', 'pause']),
('tags', ['tag', 'stats', 'images'])])
def test_get_new_command(wrong, fixed):
command = Command('docker {}'.format(wrong), output(wrong))
assert get_new_command(command) == ['docker {}'.format(x) for x in fixed]

17
tests/rules/test_dry.py Normal file
View File

@@ -0,0 +1,17 @@
import pytest
from thefuck.rules.dry import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('cd cd foo', ''),
Command('git git push origin/master', '')])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('cd cd foo', ''), 'cd foo'),
(Command('git git push origin/master', ''), 'git push origin/master')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,48 @@
import pytest
from thefuck.rules.fab_command_not_found import match, get_new_command
from thefuck.types import Command
output = '''
Warning: Command(s) not found:
extenson
deloyp
Available commands:
update_config
prepare_extension
Template A string class for supporting $-substitutions.
deploy
glob Return a list of paths matching a pathname pattern.
install_web
set_version
'''
@pytest.mark.parametrize('command', [
Command('fab extenson', output),
Command('fab deloyp', output),
Command('fab extenson deloyp', output)])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('gulp extenson', output),
Command('fab deloyp', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('script, result', [
('fab extenson', 'fab prepare_extension'),
('fab extenson:version=2016',
'fab prepare_extension:version=2016'),
('fab extenson:version=2016 install_web set_version:val=0.5.0',
'fab prepare_extension:version=2016 install_web set_version:val=0.5.0'),
('fab extenson:version=2016 deloyp:beta=true -H the.fuck',
'fab prepare_extension:version=2016 deploy:beta=true -H the.fuck'),
])
def test_get_new_command(script, result):
command = Command(script, output)
assert get_new_command(command) == result

View File

@@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
from thefuck.rules.fix_alt_space import match, get_new_command
from thefuck.types import Command
def test_match():
"""The character before 'grep' is Alt+Space, which happens frequently
on the Mac when typing the pipe character (Alt+7), and holding the Alt
key pressed for longer than necessary.
"""
assert match(Command(u'ps -ef | grep foo',
u'-bash:  grep: command not found'))
assert not match(Command('ps -ef | grep foo', ''))
assert not match(Command('', ''))
def test_get_new_command():
""" Replace the Alt+Space character by a simple space """
assert (get_new_command(Command(u'ps -ef | grep foo', ''))
== 'ps -ef | grep foo')

View File

@@ -0,0 +1,245 @@
# -*- coding: utf-8 -*-
import pytest
import os
from thefuck.rules.fix_file import match, get_new_command
from thefuck.types import Command
# (script, file, line, col (or None), output)
tests = (
('gcc a.c', 'a.c', 3, 1,
"""
a.c: In function 'main':
a.c:3:1: error: expected expression before '}' token
}
^
"""),
('clang a.c', 'a.c', 3, 1,
"""
a.c:3:1: error: expected expression
}
^
"""),
('perl a.pl', 'a.pl', 3, None,
"""
syntax error at a.pl line 3, at EOF
Execution of a.pl aborted due to compilation errors.
"""),
('perl a.pl', 'a.pl', 2, None,
"""
Search pattern not terminated at a.pl line 2.
"""),
('sh a.sh', 'a.sh', 2, None,
"""
a.sh: line 2: foo: command not found
"""),
('zsh a.sh', 'a.sh', 2, None,
"""
a.sh:2: command not found: foo
"""),
('bash a.sh', 'a.sh', 2, None,
"""
a.sh: line 2: foo: command not found
"""),
('rustc a.rs', 'a.rs', 2, 5,
"""
a.rs:2:5: 2:6 error: unexpected token: `+`
a.rs:2 +
^
"""),
('cargo build', 'src/lib.rs', 3, 5,
"""
Compiling test v0.1.0 (file:///tmp/fix-error/test)
src/lib.rs:3:5: 3:6 error: unexpected token: `+`
src/lib.rs:3 +
^
Could not compile `test`.
To learn more, run the command again with --verbose.
"""),
('python a.py', 'a.py', 2, None,
"""
File "a.py", line 2
+
^
SyntaxError: invalid syntax
"""),
('python a.py', 'a.py', 8, None,
"""
Traceback (most recent call last):
File "a.py", line 8, in <module>
match("foo")
File "a.py", line 5, in match
m = re.search(None, command)
File "/usr/lib/python3.4/re.py", line 170, in search
return _compile(pattern, flags).search(string)
File "/usr/lib/python3.4/re.py", line 293, in _compile
raise TypeError("first argument must be string or compiled pattern")
TypeError: first argument must be string or compiled pattern
"""),
(u'python café.py', u'café.py', 8, None,
u"""
Traceback (most recent call last):
File "café.py", line 8, in <module>
match("foo")
File "café.py", line 5, in match
m = re.search(None, command)
File "/usr/lib/python3.4/re.py", line 170, in search
return _compile(pattern, flags).search(string)
File "/usr/lib/python3.4/re.py", line 293, in _compile
raise TypeError("first argument must be string or compiled pattern")
TypeError: first argument must be string or compiled pattern
"""),
('ruby a.rb', 'a.rb', 3, None,
"""
a.rb:3: syntax error, unexpected keyword_end
"""),
('lua a.lua', 'a.lua', 2, None,
"""
lua: a.lua:2: unexpected symbol near '+'
"""),
('fish a.sh', '/tmp/fix-error/a.sh', 2, None,
"""
fish: Unknown command 'foo'
/tmp/fix-error/a.sh (line 2): foo
^
"""),
('./a', './a', 2, None,
"""
awk: ./a:2: BEGIN { print "Hello, world!" + }
awk: ./a:2: ^ syntax error
"""),
('llc a.ll', 'a.ll', 1, 2,
"""
llc: a.ll:1:2: error: expected top-level entity
+
^
"""),
('go build a.go', 'a.go', 1, 2,
"""
can't load package:
a.go:1:2: expected 'package', found '+'
"""),
('make', 'Makefile', 2, None,
"""
bidule
make: bidule: Command not found
Makefile:2: recipe for target 'target' failed
make: *** [target] Error 127
"""),
('git st', '/home/martin/.config/git/config', 1, None,
"""
fatal: bad config file line 1 in /home/martin/.config/git/config
"""),
('node fuck.js asdf qwer', '/Users/pablo/Workspace/barebones/fuck.js', '2', 5,
"""
/Users/pablo/Workspace/barebones/fuck.js:2
conole.log(arg); // this should read console.log(arg);
^
ReferenceError: conole is not defined
at /Users/pablo/Workspace/barebones/fuck.js:2:5
at Array.forEach (native)
at Object.<anonymous> (/Users/pablo/Workspace/barebones/fuck.js:1:85)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
"""),
('pep8', './tests/rules/test_systemctl.py', 17, 80,
"""
./tests/rules/test_systemctl.py:17:80: E501 line too long (93 > 79 characters)
./tests/rules/test_systemctl.py:18:80: E501 line too long (103 > 79 characters)
./tests/rules/test_whois.py:20:80: E501 line too long (89 > 79 characters)
./tests/rules/test_whois.py:22:80: E501 line too long (83 > 79 characters)
"""),
('py.test', '/home/thefuck/tests/rules/test_fix_file.py', 218, None,
"""
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7fdb76a25b38>
test = ('fish a.sh', '/tmp/fix-error/a.sh', 2, None, '', "\\nfish: Unknown command 'foo'\\n/tmp/fix-error/a.sh (line 2): foo\\n ^\\n")
@pytest.mark.parametrize('test', tests)
@pytest.mark.usefixtures('no_memoize')
def test_get_new_command(monkeypatch, test):
> mocker.patch('os.path.isfile', return_value=True)
E NameError: name 'mocker' is not defined
/home/thefuck/tests/rules/test_fix_file.py:218: NameError
"""),
) # noqa
@pytest.mark.parametrize('test', tests)
@pytest.mark.usefixtures('no_memoize')
def test_match(mocker, monkeypatch, test):
mocker.patch('os.path.isfile', return_value=True)
monkeypatch.setenv('EDITOR', 'dummy_editor')
assert match(Command('', test[4]))
@pytest.mark.parametrize('test', tests)
@pytest.mark.usefixtures('no_memoize')
def test_no_editor(mocker, monkeypatch, test):
mocker.patch('os.path.isfile', return_value=True)
if 'EDITOR' in os.environ:
monkeypatch.delenv('EDITOR')
assert not match(Command('', test[4]))
@pytest.mark.parametrize('test', tests)
@pytest.mark.usefixtures('no_memoize')
def test_not_file(mocker, monkeypatch, test):
mocker.patch('os.path.isfile', return_value=False)
monkeypatch.setenv('EDITOR', 'dummy_editor')
assert not match(Command('', test[4]))
@pytest.mark.parametrize('test', tests)
@pytest.mark.usefixtures('no_memoize')
def test_get_new_command(mocker, monkeypatch, test):
mocker.patch('os.path.isfile', return_value=True)
monkeypatch.setenv('EDITOR', 'dummy_editor')
@pytest.mark.parametrize('test', tests)
@pytest.mark.usefixtures('no_memoize')
def test_get_new_command_with_settings(mocker, monkeypatch, test, settings):
mocker.patch('os.path.isfile', return_value=True)
monkeypatch.setenv('EDITOR', 'dummy_editor')
cmd = Command(test[0], test[4])
settings.fixcolcmd = '{editor} {file} +{line}:{col}'
if test[3]:
assert (get_new_command(cmd) ==
u'dummy_editor {} +{}:{} && {}'.format(test[1], test[2], test[3], test[0]))
else:
assert (get_new_command(cmd) ==
u'dummy_editor {} +{} && {}'.format(test[1], test[2], test[0]))

View File

@@ -0,0 +1,82 @@
import pytest
from six import BytesIO
from thefuck.rules.gem_unknown_command import match, get_new_command
from thefuck.types import Command
output = '''
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command {}
'''
gem_help_commands_stdout = b'''
GEM commands are:
build Build a gem from a gemspec
cert Manage RubyGems certificates and signing settings
check Check a gem repository for added or missing files
cleanup Clean up old versions of installed gems
contents Display the contents of the installed gems
dependency Show the dependencies of an installed gem
environment Display information about the RubyGems environment
fetch Download a gem and place it in the current directory
generate_index Generates the index files for a gem server directory
help Provide help on the 'gem' command
install Install a gem into the local repository
list Display local gems whose name matches REGEXP
lock Generate a lockdown list of gems
mirror Mirror all gem files (requires rubygems-mirror)
open Open gem sources in editor
outdated Display all gems that need updates
owner Manage gem owners of a gem on the push server
pristine Restores installed gems to pristine condition from files
located in the gem cache
push Push a gem up to the gem server
query Query gem information in local or remote repositories
rdoc Generates RDoc for pre-installed gems
search Display remote gems whose name matches REGEXP
server Documentation and gem repository HTTP server
sources Manage the sources and cache file RubyGems uses to search
for gems
specification Display gem specification (in yaml)
stale List gems along with access times
uninstall Uninstall gems from the local repository
unpack Unpack an installed gem to the current directory
update Update installed gems to the latest version
which Find the location of a library file you can require
yank Remove a pushed gem from the index
For help on a particular command, use 'gem help COMMAND'.
Commands may be abbreviated, so long as they are unambiguous.
e.g. 'gem i rake' is short for 'gem install rake'.
'''
@pytest.fixture(autouse=True)
def gem_help_commands(mocker):
patch = mocker.patch('subprocess.Popen')
patch.return_value.stdout = BytesIO(gem_help_commands_stdout)
return patch
@pytest.mark.parametrize('script, command', [
('gem isntall jekyll', 'isntall'),
('gem last --local', 'last')])
def test_match(script, command):
assert match(Command(script, output.format(command)))
@pytest.mark.parametrize('script, output', [
('gem install jekyll', ''),
('git log', output.format('log'))])
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.mark.parametrize('script, output, result', [
('gem isntall jekyll', output.format('isntall'), 'gem install jekyll'),
('gem last --local', output.format('last'), 'gem list --local')])
def test_get_new_command(script, output, result):
new_command = get_new_command(Command(script, output))
assert new_command[0] == result

View File

@@ -0,0 +1,40 @@
import pytest
from thefuck.rules.git_add import match, get_new_command
from thefuck.types import Command
@pytest.fixture(autouse=True)
def path_exists(mocker):
return mocker.patch('thefuck.rules.git_add.Path.exists',
return_value=True)
@pytest.fixture
def output(target):
return ("error: pathspec '{}' did not match any "
'file(s) known to git.'.format(target))
@pytest.mark.parametrize('script, target', [
('git submodule update unknown', 'unknown'),
('git commit unknown', 'unknown')])
def test_match(output, script, target):
assert match(Command(script, output))
@pytest.mark.parametrize('script, target, exists', [
('git submodule update known', '', True),
('git commit known', '', True),
('git submodule update known', output, False)])
def test_not_match(path_exists, output, script, target, exists):
path_exists.return_value = exists
assert not match(Command(script, output))
@pytest.mark.parametrize('script, target, new_command', [
('git submodule update unknown', 'unknown',
'git add -- unknown && git submodule update unknown'),
('git commit unknown', 'unknown',
'git add -- unknown && git commit unknown')])
def test_get_new_command(output, script, target, new_command):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,22 @@
import pytest
from thefuck.rules.git_add_force import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return ('The following paths are ignored by one of your .gitignore files:\n'
'dist/app.js\n'
'dist/background.js\n'
'dist/options.js\n'
'Use -f if you really want to add them.\n')
def test_match(output):
assert match(Command('git add dist/*.js', output))
assert not match(Command('git add dist/*.js', ''))
def test_get_new_command(output):
assert (get_new_command(Command('git add dist/*.js', output))
== "git add --force dist/*.js")

View File

@@ -0,0 +1,30 @@
import pytest
from thefuck.types import Command
from thefuck.rules.git_bisect_usage import match, get_new_command
@pytest.fixture
def output():
return ("usage: git bisect [help|start|bad|good|new|old"
"|terms|skip|next|reset|visualize|replay|log|run]")
@pytest.mark.parametrize('script', [
'git bisect strt', 'git bisect rset', 'git bisect goood'])
def test_match(output, script):
assert match(Command(script, output))
@pytest.mark.parametrize('script', [
'git bisect', 'git bisect start', 'git bisect good'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, new_cmd, ', [
('git bisect goood', ['good', 'old', 'log']),
('git bisect strt', ['start', 'terms', 'reset']),
('git bisect rset', ['reset', 'next', 'start'])])
def test_get_new_command(output, script, new_cmd):
new_cmd = ['git bisect %s' % cmd for cmd in new_cmd]
assert get_new_command(Command(script, output)) == new_cmd

View File

@@ -0,0 +1,22 @@
import pytest
from thefuck.rules.git_branch_delete import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''error: The branch 'branch' is not fully merged.
If you are sure you want to delete it, run 'git branch -D branch'.
'''
def test_match(output):
assert match(Command('git branch -d branch', output))
assert not match(Command('git branch -d branch', ''))
assert not match(Command('ls', output))
def test_get_new_command(output):
assert get_new_command(Command('git branch -d branch', output))\
== "git branch -D branch"

View File

@@ -0,0 +1,41 @@
import pytest
from thefuck.rules.git_branch_exists import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output(src_branch_name):
return "fatal: A branch named '{}' already exists.".format(src_branch_name)
@pytest.fixture
def new_command(branch_name):
return [cmd.format(branch_name) for cmd in [
'git branch -d {0} && git branch {0}',
'git branch -d {0} && git checkout -b {0}',
'git branch -D {0} && git branch {0}',
'git branch -D {0} && git checkout -b {0}', 'git checkout {0}']]
@pytest.mark.parametrize('script, src_branch_name, branch_name', [
('git branch foo', 'foo', 'foo'),
('git checkout bar', 'bar', 'bar'),
('git checkout -b "let\'s-push-this"', '"let\'s-push-this"', '"let\'s-push-this"')])
def test_match(output, script, branch_name):
assert match(Command(script, output))
@pytest.mark.parametrize('script', [
'git branch foo',
'git checkout bar',
'git checkout -b "let\'s-push-this"'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, src_branch_name, branch_name', [
('git branch foo', 'foo', 'foo'),
('git checkout bar', 'bar', 'bar'),
('git checkout -b "let\'s-push-this"', "let's-push-this", "let\\'s-push-this")])
def test_get_new_command(output, new_command, script, src_branch_name, branch_name):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,19 @@
from thefuck.rules.git_branch_list import match, get_new_command
from thefuck.shells import shell
from thefuck.types import Command
def test_match():
assert match(Command('git branch list', ''))
def test_not_match():
assert not match(Command('', ''))
assert not match(Command('git commit', ''))
assert not match(Command('git branch', ''))
assert not match(Command('git stash list', ''))
def test_get_new_command():
assert (get_new_command(Command('git branch list', '')) ==
shell.and_('git branch --delete list', 'git branch'))

View File

@@ -0,0 +1,69 @@
import pytest
from io import BytesIO
from thefuck.rules.git_checkout import match, get_branches, get_new_command
from thefuck.types import Command
@pytest.fixture
def did_not_match(target, did_you_forget=False):
error = ("error: pathspec '{}' did not match any "
"file(s) known to git.".format(target))
if did_you_forget:
error = ("{}\nDid you forget to 'git add'?'".format(error))
return error
@pytest.fixture
def git_branch(mocker, branches):
mock = mocker.patch('subprocess.Popen')
mock.return_value.stdout = BytesIO(branches)
return mock
@pytest.mark.parametrize('command', [
Command('git checkout unknown', did_not_match('unknown')),
Command('git commit unknown', did_not_match('unknown'))])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git submodule update unknown',
did_not_match('unknown', True)),
Command('git checkout known', ''),
Command('git commit known', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('branches, branch_list', [
(b'', []),
(b'* master', ['master']),
(b' remotes/origin/master', ['master']),
(b' just-another-branch', ['just-another-branch']),
(b'* master\n just-another-branch', ['master', 'just-another-branch']),
(b'* master\n remotes/origin/master\n just-another-branch',
['master', 'master', 'just-another-branch'])])
def test_get_branches(branches, branch_list, git_branch):
git_branch(branches)
assert list(get_branches()) == branch_list
@pytest.mark.parametrize('branches, command, new_command', [
(b'',
Command('git checkout unknown', did_not_match('unknown')),
'git checkout -b unknown'),
(b'',
Command('git commit unknown', did_not_match('unknown')),
'git branch unknown && git commit unknown'),
(b' test-random-branch-123',
Command('git checkout tst-rdm-brnch-123',
did_not_match('tst-rdm-brnch-123')),
'git checkout test-random-branch-123'),
(b' test-random-branch-123',
Command('git commit tst-rdm-brnch-123',
did_not_match('tst-rdm-brnch-123')),
'git commit test-random-branch-123')])
def test_get_new_command(branches, command, new_command, git_branch):
git_branch(branches)
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,25 @@
import pytest
from thefuck.rules.git_commit_amend import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('script, output', [
('git commit -m "test"', 'test output'),
('git commit', '')])
def test_match(output, script):
assert match(Command(script, output))
@pytest.mark.parametrize('script', [
'git branch foo',
'git checkout feature/test_commit',
'git push'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script', [
('git commit -m "test commit"'),
('git commit')])
def test_get_new_command(script):
assert get_new_command(Command(script, '')) == 'git commit --amend'

View File

@@ -0,0 +1,23 @@
import pytest
from thefuck.rules.git_diff_no_index import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('git diff foo bar', '')])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git diff --no-index foo bar', ''),
Command('git diff foo', ''),
Command('git diff foo bar baz', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('git diff foo bar', ''), 'git diff --no-index foo bar')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,26 @@
import pytest
from thefuck.rules.git_diff_staged import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('git diff foo', ''),
Command('git diff', '')])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git diff --staged', ''),
Command('git tag', ''),
Command('git branch', ''),
Command('git log', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('git diff', ''), 'git diff --staged'),
(Command('git diff foo', ''), 'git diff --staged foo')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,35 @@
import pytest
from thefuck.rules.git_fix_stash import match, get_new_command
from thefuck.types import Command
git_stash_err = '''
usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
\t\t [-u|--include-untracked] [-a|--all] [<message>]]
or: git stash clear
'''
@pytest.mark.parametrize('wrong', [
'git stash opp',
'git stash Some message',
'git stash saev Some message'])
def test_match(wrong):
assert match(Command(wrong, git_stash_err))
def test_not_match():
assert not match(Command("git", git_stash_err))
@pytest.mark.parametrize('wrong,fixed', [
('git stash opp', 'git stash pop'),
('git stash Some message', 'git stash save Some message'),
('git stash saev Some message', 'git stash save Some message')])
def test_get_new_command(wrong, fixed):
assert get_new_command(Command(wrong, git_stash_err)) == fixed

View File

@@ -0,0 +1,40 @@
import pytest
from thefuck.rules.git_flag_after_filename import match, get_new_command
from thefuck.types import Command
command1 = Command('git log README.md -p',
"fatal: bad flag '-p' used after filename")
command2 = Command('git log README.md -p CONTRIBUTING.md',
"fatal: bad flag '-p' used after filename")
command3 = Command('git log -p README.md --name-only',
"fatal: bad flag '--name-only' used after filename")
command4 = Command('git log README.md -p',
"fatal: option '-p' must come before non-option arguments")
command5 = Command('git log README.md -p CONTRIBUTING.md',
"fatal: option '-p' must come before non-option arguments")
command6 = Command('git log -p README.md --name-only',
"fatal: option '--name-only' must come before non-option arguments")
@pytest.mark.parametrize('command', [
command1, command2, command3, command4, command5, command6])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git log README.md', ''),
Command('git log -p README.md', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, result', [
(command1, "git log -p README.md"),
(command2, "git log -p README.md CONTRIBUTING.md"),
(command3, "git log -p --name-only README.md"),
(command4, "git log -p README.md"),
(command5, "git log -p README.md CONTRIBUTING.md"),
(command6, "git log -p --name-only README.md")])
def test_get_new_command(command, result):
assert get_new_command(command) == result

View File

@@ -0,0 +1,24 @@
import pytest
from thefuck.rules.git_help_aliased import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('script, output', [
('git help st', "`git st' is aliased to `status'"),
('git help ds', "`git ds' is aliased to `diff --staged'")])
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize('script, output', [
('git help status', "GIT-STATUS(1)...Git Manual...GIT-STATUS(1)"),
('git help diff', "GIT-DIFF(1)...Git Manual...GIT-DIFF(1)")])
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.mark.parametrize('script, output, new_command', [
('git help st', "`git st' is aliased to `status'", 'git help status'),
('git help ds', "`git ds' is aliased to `diff --staged'", 'git help diff')])
def test_get_new_command(script, output, new_command):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,26 @@
import pytest
from thefuck.rules.git_merge import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return 'merge: local - not something we can merge\n\n' \
'Did you mean this?\n\tremote/local'
def test_match(output):
assert match(Command('git merge test', output))
assert not match(Command('git merge master', ''))
assert not match(Command('ls', output))
@pytest.mark.parametrize('command, new_command', [
(Command('git merge local', output()),
'git merge remote/local'),
(Command('git merge -m "test" local', output()),
'git merge -m "test" remote/local'),
(Command('git merge -m "test local" local', output()),
'git merge -m "test local" remote/local')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,25 @@
import pytest
from thefuck.rules.git_merge_unrelated import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return 'fatal: refusing to merge unrelated histories'
def test_match(output):
assert match(Command('git merge test', output))
assert not match(Command('git merge master', ''))
assert not match(Command('ls', output))
@pytest.mark.parametrize('command, new_command', [
(Command('git merge local', output()),
'git merge local --allow-unrelated-histories'),
(Command('git merge -m "test" local', output()),
'git merge -m "test" local --allow-unrelated-histories'),
(Command('git merge -m "test local" local', output()),
'git merge -m "test local" local --allow-unrelated-histories')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -1,13 +1,13 @@
import pytest
from thefuck.main import Command
from thefuck.rules.git_not_command import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def git_not_command():
return """git: 'brnch' is not a git command. See 'git --help'.
Did you mean this?
The most similar command is
branch
"""
@@ -16,7 +16,7 @@ branch
def git_not_command_one_of_this():
return """git: 'st' is not a git command. See 'git --help'.
Did you mean one of these?
The most similar commands are
status
reset
stage
@@ -25,20 +25,33 @@ stats
"""
@pytest.fixture
def git_not_command_closest():
return '''git: 'tags' is not a git command. See 'git --help'.
The most similar commands are
\tstage
\ttag
'''
@pytest.fixture
def git_command():
return "* master"
def test_match(git_not_command, git_command, git_not_command_one_of_this):
assert match(Command('git brnch', '', git_not_command), None)
assert match(Command('git st', '', git_not_command_one_of_this), None)
assert not match(Command('ls brnch', '', git_not_command), None)
assert not match(Command('git branch', '', git_command), None)
assert match(Command('git brnch', git_not_command))
assert match(Command('git st', git_not_command_one_of_this))
assert not match(Command('ls brnch', git_not_command))
assert not match(Command('git branch', git_command))
def test_get_new_command(git_not_command, git_not_command_one_of_this):
assert get_new_command(Command('git brnch', '', git_not_command), None)\
== 'git branch'
assert get_new_command(
Command('git st', '', git_not_command_one_of_this), None) == 'git status'
def test_get_new_command(git_not_command, git_not_command_one_of_this,
git_not_command_closest):
assert (get_new_command(Command('git brnch', git_not_command))
== ['git branch'])
assert (get_new_command(Command('git st', git_not_command_one_of_this))
== ['git stats', 'git stash', 'git stage'])
assert (get_new_command(Command('git tags', git_not_command_closest))
== ['git tag', 'git stage'])

View File

@@ -0,0 +1,29 @@
import pytest
from thefuck.rules.git_pull import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=<remote>/<branch> master
'''
def test_match(output):
assert match(Command('git pull', output))
assert not match(Command('git pull', ''))
assert not match(Command('ls', output))
def test_get_new_command(output):
assert (get_new_command(Command('git pull', output))
== "git branch --set-upstream-to=origin/master master && git pull")

View File

@@ -0,0 +1,21 @@
import pytest
from thefuck.rules.git_pull_clone import match, get_new_command
from thefuck.types import Command
git_err = '''
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
'''
@pytest.mark.parametrize('command', [
Command('git pull git@github.com:mcarton/thefuck.git', git_err)])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command, output', [
(Command('git pull git@github.com:mcarton/thefuck.git', git_err), 'git clone git@github.com:mcarton/thefuck.git')])
def test_get_new_command(command, output):
assert get_new_command(command) == output

View File

@@ -0,0 +1,19 @@
import pytest
from thefuck.rules.git_pull_uncommitted_changes import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''error: Cannot pull with rebase: You have unstaged changes.'''
def test_match(output):
assert match(Command('git pull', output))
assert not match(Command('git pull', ''))
assert not match(Command('ls', output))
def test_get_new_command(output):
assert (get_new_command(Command('git pull', output))
== "git stash && git pull && git stash pop")

View File

@@ -0,0 +1,19 @@
import pytest
from thefuck.rules.git_pull_uncommitted_changes import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''error: Cannot pull with rebase: Your index contains uncommitted changes.'''
def test_match(output):
assert match(Command('git pull', output))
assert not match(Command('git pull', ''))
assert not match(Command('ls', output))
def test_get_new_command(output):
assert (get_new_command(Command('git pull', output))
== "git stash && git pull && git stash pop")

View File

@@ -1,24 +1,71 @@
import pytest
from thefuck.main import Command
from thefuck.rules.git_push import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def stderr():
return '''fatal: The current branch master has no upstream branch.
def output(branch_name):
if not branch_name:
return ''
return '''fatal: The current branch {} has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
git push --set-upstream origin {}
'''.format(branch_name, branch_name)
@pytest.fixture
def output_bitbucket():
return '''Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create pull request for feature/set-upstream:
remote: https://bitbucket.org/set-upstream
remote:
To git@bitbucket.org:test.git
e5e7fbb..700d998 feature/set-upstream -> feature/set-upstream
Branch feature/set-upstream set up to track remote branch feature/set-upstream from origin.
'''
def test_match(stderr):
assert match(Command('git push master', '', stderr), None)
assert not match(Command('git push master', '', ''), None)
assert not match(Command('ls', '', stderr), None)
@pytest.mark.parametrize('script, branch_name', [
('git push', 'master'),
('git push origin', 'master')])
def test_match(output, script, branch_name):
assert match(Command(script, output))
def test_get_new_command(stderr):
assert get_new_command(Command('', '', stderr), None)\
== "git push --set-upstream origin master"
def test_match_bitbucket(output_bitbucket):
assert not match(Command('git push origin', output_bitbucket))
@pytest.mark.parametrize('script, branch_name', [
('git push master', None),
('ls', 'master')])
def test_not_match(output, script, branch_name):
assert not match(Command(script, output))
@pytest.mark.parametrize('script, branch_name, new_command', [
('git push', 'master',
'git push --set-upstream origin master'),
('git push master', 'master',
'git push --set-upstream origin master'),
('git push -u', 'master',
'git push --set-upstream origin master'),
('git push -u origin', 'master',
'git push --set-upstream origin master'),
('git push origin', 'master',
'git push --set-upstream origin master'),
('git push --set-upstream origin', 'master',
'git push --set-upstream origin master'),
('git push --quiet', 'master',
'git push --set-upstream origin master --quiet'),
('git push --quiet origin', 'master',
'git push --set-upstream origin master --quiet'),
('git -c test=test push --quiet origin', 'master',
'git -c test=test push --set-upstream origin master --quiet'),
('git push', "test's",
"git push --set-upstream origin test\\'s")])
def test_get_new_command(output, script, branch_name, new_command):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,39 @@
import pytest
from thefuck.rules.git_push_different_branch_names import get_new_command, match
from thefuck.types import Command
output = """fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push origin HEAD:%s
To push to the branch of the same name on the remote, use
git push origin %s
To choose either option permanently, see push.default in 'git help config'.
"""
def error_msg(localbranch, remotebranch):
return output % (remotebranch, localbranch)
def test_match():
assert match(Command('git push', error_msg('foo', 'bar')))
@pytest.mark.parametrize('command', [
Command('vim', ''),
Command('git status', error_msg('foo', 'bar')),
Command('git push', '')
])
def test_not_match(command):
assert not match(command)
def test_get_new_command():
new_command = get_new_command(Command('git push', error_msg('foo', 'bar')))
assert new_command == 'git push origin HEAD:bar'

View File

@@ -0,0 +1,52 @@
import pytest
from thefuck.rules.git_push_force import match, get_new_command
from thefuck.types import Command
git_err = '''
To /tmp/foo
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/tmp/bar'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
'''
git_uptodate = 'Everything up-to-date'
git_ok = '''
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 282 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /tmp/bar
514eed3..f269c79 master -> master
'''
@pytest.mark.parametrize('command', [
Command('git push', git_err),
Command('git push nvbn', git_err),
Command('git push nvbn master', git_err)])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git push', git_ok),
Command('git push', git_uptodate),
Command('git push nvbn', git_ok),
Command('git push nvbn master', git_uptodate),
Command('git push nvbn', git_ok),
Command('git push nvbn master', git_uptodate)])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, output', [
(Command('git push', git_err), 'git push --force-with-lease'),
(Command('git push nvbn', git_err), 'git push --force-with-lease nvbn'),
(Command('git push nvbn master', git_err), 'git push --force-with-lease nvbn master')])
def test_get_new_command(command, output):
assert get_new_command(command) == output

View File

@@ -0,0 +1,73 @@
import pytest
from thefuck.rules.git_push_pull import match, get_new_command
from thefuck.types import Command
git_err = '''
To /tmp/foo
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/tmp/bar'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
'''
git_err2 = '''
To /tmp/foo
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/tmp/bar'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
'''
git_uptodate = 'Everything up-to-date'
git_ok = '''
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 282 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /tmp/bar
514eed3..f269c79 master -> master
'''
@pytest.mark.parametrize('command', [
Command('git push', git_err),
Command('git push nvbn', git_err),
Command('git push nvbn master', git_err),
Command('git push', git_err2),
Command('git push nvbn', git_err2),
Command('git push nvbn master', git_err2)])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git push', git_ok),
Command('git push', git_uptodate),
Command('git push nvbn', git_ok),
Command('git push nvbn master', git_uptodate),
Command('git push nvbn', git_ok),
Command('git push nvbn master', git_uptodate)])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, output', [
(Command('git push', git_err), 'git pull && git push'),
(Command('git push nvbn', git_err),
'git pull nvbn && git push nvbn'),
(Command('git push nvbn master', git_err),
'git pull nvbn master && git push nvbn master'),
(Command('git push', git_err2), 'git pull && git push'),
(Command('git push nvbn', git_err2),
'git pull nvbn && git push nvbn'),
(Command('git push nvbn master', git_err2),
'git pull nvbn master && git push nvbn master')])
def test_get_new_command(command, output):
assert get_new_command(command) == output

View File

@@ -0,0 +1,27 @@
import pytest
from thefuck.types import Command
from thefuck.rules.git_push_without_commits import (
fix,
get_new_command,
match,
)
command = 'git push -u origin master'
expected_error = '''
error: src refspec master does not match any.
error: failed to push some refs to 'git@github.com:User/repo.git'
'''
@pytest.mark.parametrize('command', [Command(command, expected_error)])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command, result', [(
Command(command, expected_error),
fix.format(command=command),
)])
def test_get_new_command(command, result):
assert get_new_command(command) == result

View File

@@ -0,0 +1,42 @@
import pytest
from thefuck.rules.git_rebase_merge_dir import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return ('\n\nIt seems that there is already a rebase-merge directory, and\n'
'I wonder if you are in the middle of another rebase. If that is the\n'
'case, please try\n'
'\tgit rebase (--continue | --abort | --skip)\n'
'If that is not the case, please\n'
'\trm -fr "/foo/bar/baz/egg/.git/rebase-merge"\n'
'and run me again. I am stopping in case you still have something\n'
'valuable there.\n')
@pytest.mark.parametrize('script', [
'git rebase master',
'git rebase -skip',
'git rebase'])
def test_match(output, script):
assert match(Command(script, output))
@pytest.mark.parametrize('script', ['git rebase master', 'git rebase -abort'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, result', [
('git rebase master', [
'git rebase --abort', 'git rebase --skip', 'git rebase --continue',
'rm -fr "/foo/bar/baz/egg/.git/rebase-merge"']),
('git rebase -skip', [
'git rebase --skip', 'git rebase --abort', 'git rebase --continue',
'rm -fr "/foo/bar/baz/egg/.git/rebase-merge"']),
('git rebase', [
'git rebase --skip', 'git rebase --abort', 'git rebase --continue',
'rm -fr "/foo/bar/baz/egg/.git/rebase-merge"'])])
def test_get_new_command(output, script, result):
assert get_new_command(Command(script, output)) == result

View File

@@ -0,0 +1,28 @@
import pytest
from thefuck.rules.git_rebase_no_changes import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''Applying: Test commit
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'''
def test_match(output):
assert match(Command('git rebase --continue', output))
assert not match(Command('git rebase --continue', ''))
assert not match(Command('git rebase --skip', ''))
def test_get_new_command(output):
assert (get_new_command(Command('git rebase --continue', output)) ==
'git rebase --skip')

View File

@@ -0,0 +1,24 @@
import pytest
from thefuck.rules.git_remote_delete import get_new_command, match
from thefuck.types import Command
def test_match():
assert match(Command('git remote delete foo', ''))
@pytest.mark.parametrize('command', [
Command('git remote remove foo', ''),
Command('git remote add foo', ''),
Command('git commit', '')
])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('git remote delete foo', ''), 'git remote remove foo'),
(Command('git remote delete delete', ''), 'git remote remove delete'),
])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,26 @@
import pytest
from thefuck.rules.git_remote_seturl_add import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('git remote set-url origin url', "fatal: No such remote")])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git remote set-url origin url', ""),
Command('git remote add origin url', ''),
Command('git remote remove origin', ''),
Command('git remote prune origin', ''),
Command('git remote set-branches origin branch', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('git remote set-url origin git@github.com:nvbn/thefuck.git', ''),
'git remote add origin git@github.com:nvbn/thefuck.git')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,28 @@
import pytest
from thefuck.rules.git_rm_local_modifications import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output(target):
return ('error: the following file has local modifications:\n {}\n(use '
'--cached to keep the file, or -f to force removal)').format(target)
@pytest.mark.parametrize('script, target', [
('git rm foo', 'foo'),
('git rm foo bar', 'bar')])
def test_match(output, script, target):
assert match(Command(script, output))
@pytest.mark.parametrize('script', ['git rm foo', 'git rm foo bar', 'git rm'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, target, new_command', [
('git rm foo', 'foo', ['git rm --cached foo', 'git rm -f foo']),
('git rm foo bar', 'bar', ['git rm --cached foo bar', 'git rm -f foo bar'])])
def test_get_new_command(output, script, target, new_command):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,27 @@
import pytest
from thefuck.rules.git_rm_recursive import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output(target):
return "fatal: not removing '{}' recursively without -r".format(target)
@pytest.mark.parametrize('script, target', [
('git rm foo', 'foo'),
('git rm foo bar', 'foo bar')])
def test_match(output, script, target):
assert match(Command(script, output))
@pytest.mark.parametrize('script', ['git rm foo', 'git rm foo bar'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, target, new_command', [
('git rm foo', 'foo', 'git rm -r foo'),
('git rm foo bar', 'foo bar', 'git rm -r foo bar')])
def test_get_new_command(output, script, target, new_command):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,28 @@
import pytest
from thefuck.rules.git_rm_staged import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output(target):
return ('error: the following file has changes staged in the index:\n {}\n(use '
'--cached to keep the file, or -f to force removal)').format(target)
@pytest.mark.parametrize('script, target', [
('git rm foo', 'foo'),
('git rm foo bar', 'bar')])
def test_match(output, script, target):
assert match(Command(script, output))
@pytest.mark.parametrize('script', ['git rm foo', 'git rm foo bar', 'git rm'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, target, new_command', [
('git rm foo', 'foo', ['git rm --cached foo', 'git rm -f foo']),
('git rm foo bar', 'bar', ['git rm --cached foo bar', 'git rm -f foo bar'])])
def test_get_new_command(output, script, target, new_command):
assert get_new_command(Command(script, output)) == new_command

View File

@@ -0,0 +1,37 @@
import pytest
from thefuck.rules.git_stash import match, get_new_command
from thefuck.types import Command
cherry_pick_error = (
'error: Your local changes would be overwritten by cherry-pick.\n'
'hint: Commit your changes or stash them to proceed.\n'
'fatal: cherry-pick failed')
rebase_error = (
'Cannot rebase: Your index contains uncommitted changes.\n'
'Please commit or stash them.')
@pytest.mark.parametrize('command', [
Command('git cherry-pick a1b2c3d', cherry_pick_error),
Command('git rebase -i HEAD~7', rebase_error)])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git cherry-pick a1b2c3d', ''),
Command('git rebase -i HEAD~7', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('git cherry-pick a1b2c3d', cherry_pick_error),
'git stash && git cherry-pick a1b2c3d'),
(Command('git rebase -i HEAD~7', rebase_error),
'git stash && git rebase -i HEAD~7')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,18 @@
import pytest
from thefuck.rules.git_stash_pop import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''error: Your local changes to the following files would be overwritten by merge:'''
def test_match(output):
assert match(Command('git stash pop', output))
assert not match(Command('git stash', ''))
def test_get_new_command(output):
assert (get_new_command(Command('git stash pop', output))
== "git add --update && git stash pop && git reset .")

View File

@@ -0,0 +1,18 @@
import pytest
from thefuck.rules.git_tag_force import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''fatal: tag 'alert' already exists'''
def test_match(output):
assert match(Command('git tag alert', output))
assert not match(Command('git tag alert', ''))
def test_get_new_command(output):
assert (get_new_command(Command('git tag alert', output))
== "git tag --force alert")

View File

@@ -0,0 +1,45 @@
import pytest
from thefuck.rules.git_two_dashes import match, get_new_command
from thefuck.types import Command
output = 'error: did you mean `{}` (with two dashes ?)'.format
@pytest.mark.parametrize('command', [
Command('git add -patch', output('--patch')),
Command('git checkout -patch', output('--patch')),
Command('git commit -amend', output('--amend')),
Command('git push -tags', output('--tags')),
Command('git rebase -continue', output('--continue'))])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git add --patch', ''),
Command('git checkout --patch', ''),
Command('git commit --amend', ''),
Command('git push --tags', ''),
Command('git rebase --continue', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, output', [
(Command('git add -patch', output('--patch')),
'git add --patch'),
(Command('git checkout -patch', output('--patch')),
'git checkout --patch'),
(Command('git checkout -patch', output('--patch')),
'git checkout --patch'),
(Command('git init -bare', output('--bare')),
'git init --bare'),
(Command('git commit -amend', output('--amend')),
'git commit --amend'),
(Command('git push -tags', output('--tags')),
'git push --tags'),
(Command('git rebase -continue', output('--continue')),
'git rebase --continue')])
def test_get_new_command(command, output):
assert get_new_command(command) == output

View File

@@ -0,0 +1,17 @@
import pytest
from thefuck.rules.go_run import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('go run foo', ''),
Command('go run bar', '')])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('go run foo', ''), 'go run foo.go'),
(Command('go run bar', ''), 'go run bar.go')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@@ -0,0 +1,158 @@
import pytest
from io import BytesIO
from thefuck.rules.gradle_no_task import match, get_new_command
from thefuck.types import Command
gradle_tasks = b'''
:tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for each variant.
sourceSets - Prints out all the source sets defined in this project.
Build tasks
-----------
assemble - Assembles all variants of all applications and secondary packages.
assembleAndroidTest - Assembles all the Test applications.
assembleDebug - Assembles all Debug builds.
assembleRelease - Assembles all Release builds.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources
extractDebugAnnotations - Extracts Android annotations for the debug variant into the archive file
extractReleaseAnnotations - Extracts Android annotations for the release variant into the archive file
mockableAndroidJar - Creates a version of android.jar that's suitable for unit tests.
Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]
Help tasks
----------
components - Displays the components produced by root project 'org.rerenderer_example.snake'. [incubating]
dependencies - Displays all dependencies declared in root project 'org.rerenderer_example.snake'.
dependencyInsight - Displays the insight into a specific dependency in root project 'org.rerenderer_example.snake'.
help - Displays a help message.
model - Displays the configuration model of root project 'org.rerenderer_example.snake'. [incubating]
projects - Displays the sub-projects of root project 'org.rerenderer_example.snake'.
properties - Displays the properties of root project 'org.rerenderer_example.snake'.
tasks - Displays the tasks runnable from root project 'org.rerenderer_example.snake' (some of the displayed tasks may belong to subprojects).
Install tasks
-------------
installDebug - Installs the Debug build.
installDebugAndroidTest - Installs the android (on device) tests for the Debug build.
installRelease - Installs the Release build.
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build.
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build.
uninstallRelease - Uninstalls the Release build.
React tasks
-----------
bundleDebugJsAndAssets - bundle JS and assets for Debug.
bundleReleaseJsAndAssets - bundle JS and assets for Release.
Verification tasks
------------------
check - Runs all checks.
clean - Deletes the build directory.
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
lint - Runs lint on all variants.
lintDebug - Runs lint on the Debug build.
lintRelease - Runs lint on the Release build.
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testReleaseUnitTest - Run unit tests for the release build.
Other tasks
-----------
assembleDefault
copyDownloadableDepsToLibs
jarDebugClasses
jarReleaseClasses
To see all tasks and more detail, run gradlew tasks --all
To see more detail about a task, run gradlew help --task <task>
BUILD SUCCESSFUL
Total time: 1.936 secs
'''
output_not_found = '''
FAILURE: Build failed with an exception.
* What went wrong:
Task '{}' not found in root project 'org.rerenderer_example.snake'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
'''.format
output_ambiguous = '''
FAILURE: Build failed with an exception.
* What went wrong:
Task '{}' is ambiguous in root project 'org.rerenderer_example.snake'. Candidates are: 'assembleRelease', 'assembleReleaseUnitTest'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
'''.format
@pytest.fixture(autouse=True)
def tasks(mocker):
patch = mocker.patch('thefuck.rules.gradle_no_task.Popen')
patch.return_value.stdout = BytesIO(gradle_tasks)
return patch
@pytest.mark.parametrize('command', [
Command('./gradlew assembler', output_ambiguous('assembler')),
Command('./gradlew instar', output_not_found('instar')),
Command('gradle assembler', output_ambiguous('assembler')),
Command('gradle instar', output_not_found('instar'))])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('./gradlew assemble', ''),
Command('gradle assemble', ''),
Command('npm assembler', output_ambiguous('assembler')),
Command('npm instar', output_not_found('instar'))])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, result', [
(Command('./gradlew assembler', output_ambiguous('assembler')),
'./gradlew assemble'),
(Command('./gradlew instardebug', output_not_found('instardebug')),
'./gradlew installDebug'),
(Command('gradle assembler', output_ambiguous('assembler')),
'gradle assemble'),
(Command('gradle instardebug', output_not_found('instardebug')),
'gradle installDebug')])
def test_get_new_command(command, result):
assert get_new_command(command)[0] == result

View File

@@ -0,0 +1,38 @@
import pytest
from thefuck.rules.gradle_wrapper import match, get_new_command
from thefuck.types import Command
@pytest.fixture(autouse=True)
def exists(mocker):
return mocker.patch('thefuck.rules.gradle_wrapper.os.path.isfile',
return_value=True)
@pytest.mark.parametrize('command', [
Command('gradle tasks', 'gradle: not found'),
Command('gradle build', 'gradle: not found')])
def test_match(mocker, command):
mocker.patch('thefuck.rules.gradle_wrapper.which', return_value=None)
assert match(command)
@pytest.mark.parametrize('command, gradlew, which', [
(Command('gradle tasks', 'gradle: not found'), False, None),
(Command('gradle tasks', 'command not found'), True, '/usr/bin/gradle'),
(Command('npm tasks', 'npm: not found'), True, None)])
def test_not_match(mocker, exists, command, gradlew, which):
mocker.patch('thefuck.rules.gradle_wrapper.which', return_value=which)
exists.return_value = gradlew
assert not match(command)
@pytest.mark.parametrize('script, result', [
('gradle assemble', './gradlew assemble'),
('gradle --help', './gradlew --help'),
('gradle build -c', './gradlew build -c')])
def test_get_new_command(script, result):
command = Command(script, '')
assert get_new_command(command) == result

Some files were not shown because too many files have changed in this diff Show More