Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got commit corrects itself to go commit instead of git commit #475

Open
thedrow opened this issue Mar 10, 2016 · 11 comments
Open

got commit corrects itself to go commit instead of git commit #475

thedrow opened this issue Mar 10, 2016 · 11 comments

Comments

@thedrow
Copy link
Contributor

thedrow commented Mar 10, 2016

Maybe we should parse the rest of the command and see if the second argument matches the arguments of the executable?

@nvbn
Copy link
Owner

nvbn commented Mar 13, 2016

Try to upgrade to 3.6.

@thedrow
Copy link
Contributor Author

thedrow commented Mar 13, 2016

Oh I installed thefuck through homebrew which ships 3.4.
Care to update?

@thedrow
Copy link
Contributor Author

thedrow commented Mar 14, 2016

I got 3.6 and I get git as one of the options but the first one is still go and not git.

@smithtrenton
Copy link

I'm getting a similar issue with gitp ush being corrected to git ush on 3.6 using python 2.7.10

@scorphus
Copy link
Collaborator

Mind you, TheFuck is not a magic wand you wave and “ta daaaa!”. No. 😃

@smithtrenton
Copy link

But suggesting a command that doesn't exist as the first option kind of makes it useless?

@mcarton
Copy link
Contributor

mcarton commented Mar 14, 2016

On the other hand you can’t really expect The Fuck to know about all subcommands of all commands.

@thedrow
Copy link
Contributor Author

thedrow commented Mar 15, 2016

Why not? If the --help of the command can be parsed we should be able to figure out the right command right away.

@Kurtoid
Copy link

Kurtoid commented Mar 15, 2016

That sounds like a cool idea...

On Tue, Mar 15, 2016, 3:17 AM Omer Katz notifications@github.com wrote:

Why not? If the --help of the command can be parsed we should be able to
figure out the right command right away.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#475 (comment)

~Kurt

@mcarton
Copy link
Contributor

mcarton commented Mar 15, 2016

Some commands have --help, some have -h, some have -help, some have -?, some have help, some have a man page. There is no consistent way to get help for a command. Even if there were, the format of that help is not consistent either. Compare:

% git --help
usage: git [--version] [--help] [-C <path>] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone      Clone a repository into a new directory
   init       Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add        Add file contents to the index
   mv         Move or rename a file, a directory, or a symlink
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index

[a few other such sections]

% svn --help
usage: svn <subcommand> [options] [args]
Subversion command-line client.
Type 'svn help <subcommand>' for help on a specific subcommand.
Type 'svn --version' to see the program version and RA modules
  or 'svn --version --quiet' to see just the version number.

Most subcommands take file and/or directory arguments, recursing
on the directories.  If no arguments are supplied to such a
command, it recurses on the current directory (inclusive) by default.

Available subcommands:
   add
   auth
   blame (praise, annotate, ann)
   cat
   changelist (cl)
   checkout (co)
   cleanup
[etc]

% hg --help
Mercurial Distributed SCM

list of commands:

 add           add the specified files on the next commit
 addremove     add all new files, delete all missing files
 annotate      show changeset information by line for each file
 archive       create an unversioned archive of a repository revision
 backout       reverse effect of earlier changeset
 bisect        subdivision search of changesets
 bookmarks     create a new bookmark or list existing bookmarks
 branch        set or show the current branch name
[etc]

additional help topics:

 config        Configuration Files
 dates         Date Formats
 diffs         Diff Formats
 environment   Environment Variables
 extensions    Using Additional Features
 filesets      Specifying File Sets
 glossary      Glossary
[etc]

% cargo --help
Rust's package manager

Usage:
    cargo <command> [<args>...]
    cargo [options]

Options:
    -h, --help          Display this message
    -V, --version       Print version info and exit
    --list              List installed commands
    -v, --verbose       Use verbose output
    -q, --quiet         No output printed to stdout
    --color WHEN        Coloring: auto, always, never

Some common cargo commands are:
    build       Compile the current project
    clean       Remove the target directory
    doc         Build this project's and its dependencies' documentation
    new         Create a new cargo project
    init        Create a new cargo project in an existing directory
    run         Build and execute src/main.rs
[etc]

You might think getting the list of sub-commands from that is easy, but nay. hg does not have a diffs sub-command for example, diffs is an additional help topics. And that’s just 4 commands with a <command> <sub-command> <other> <stuffs> model. The Fuck would either have to special case every command or would have a very poor parsing :sad:.

@thedrow
Copy link
Contributor Author

thedrow commented Mar 15, 2016

:(
In that case it might be worth searching through the history and comparing differences.
If we don't see go commit but do see git commit for example then we should suggest it first.

amtrivedi91 added a commit to amtrivedi91/thefuck that referenced this issue Aug 31, 2016
amtrivedi91 added a commit to amtrivedi91/thefuck that referenced this issue Aug 31, 2016
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants