1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
Commit Graph

582 Commits

Author SHA1 Message Date
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
cfa831c88d #614: Add --repeat option 2017-03-28 18:09:38 +02: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
beda1854cf #620: Add bash support 2017-03-28 12:01:09 +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
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
5b1f3ff816 Merge branch 'master' of git://github.com/Asday/thefuck into Asday-master 2017-03-22 13:57:18 +01:00
Adam Barnes
e61271dae3 Removed another unused import.
Goodness.
2017-03-22 10:59:27 +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
6f39edc155 #611: Force use MagicMock in tests 2017-03-13 23:35: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
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
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
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
e009f0a05b Fix flake8 errors: E305 expected 2 blank lines after class or function definition 2017-03-08 19:53:54 -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
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
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
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
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
dhilipsiva
55dcf06569
Hostscli 2017-02-05 14:50:36 +05:30
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
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
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
a778ea6203 #588: Stop using bashlex 2017-01-11 14:58:50 +01:00
Vladimir Iakovlev
4a0d71c1c4 #N/A: Add ifconfig_device_not_found rule 2017-01-09 18:13:37 +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
dbedcc7aa6 Test parsing bash arithmetic expressions 2016-11-23 07:36:58 -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
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
Joseph Frazier
756044e087 Suggest ls -A when ls has no output 2016-10-31 13:49:38 -04: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
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
Pablo Santiago Blum de Aguiar
af28f0334a #N/A: Add git_rm_local_modifications rule 2016-10-29 17:51:55 -02: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
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
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
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
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
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
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
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
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
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
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
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
Pablo Santiago Blum de Aguiar
c9264aff10 #N/A: Add git_bisect_usage rule 2016-09-27 19:42:01 -03:00