Giter Site home page Giter Site logo

Comments (11)

nvbn avatar nvbn commented on May 13, 2024

There's a settings command_not_found for path to command-not-found.

from thefuck.

sariyamelody avatar sariyamelody commented on May 13, 2024

Are you suggesting that instead of a properly generic method, the correct path is instead simply using command-not-found?

from thefuck.

academo avatar academo commented on May 13, 2024

I think this is related to #2 and #23

from thefuck.

academo avatar academo commented on May 13, 2024

@skyhighwings @nvbn I found an implementation of command not found https://github.com/bfontaine/homebrew-command-not-found but it is not actually trying to correct command names but only suggesting to install packages you don't have if you write the right name.

from thefuck.

sariyamelody avatar sariyamelody commented on May 13, 2024

@academo yes, it is related to those :-)

I'd be willing to write a Levenshtein-based command finder later, but I don't know Python nearly as well as I do other languages.

from thefuck.

academo avatar academo commented on May 13, 2024

@skyhighwings I think you can write them in other languages and then run it into python I don't know python either.

from thefuck.

rperce avatar rperce commented on May 13, 2024

Ah ha! This is perhaps why it doesn't work on Arch Linux.

from thefuck.

sariyamelody avatar sariyamelody commented on May 13, 2024

@rperce that is precisely why it doesn't work on Arch, actually!

from thefuck.

cdipaolo avatar cdipaolo commented on May 13, 2024

I'd love to do this, but I won't be able to do it until this coming weekend. Lot's of work going on. If the timing is a problem let me know and somebody else can take it. A lot of the stuff below is based on @skyhighwings suggestions above

Heres the implementation I think would work best. Suggestions would be welcome:

  1. do a $PATH walk and store all executable binaries on a CSV file with a timestamp.
    • include alias names in CSV list
  2. on fuck, check if the timestamp is older than some config variable (default 7 days.)
  3. if it is older, then rewalk the $PATH.
  4. if current, calculate the minimum Lavenstein distance from the CSV list of commands
    • if, while running through the commands, the current minimum is 1 insertion/deletion/modification, then return that command
  5. either ask the user or just run the command

jpeg image-be3727156eaf-1

Also, there might be a more efficient way of calculating the best word for our purposes rather than using the Lavenstien distance, because running it on a list takes O(words*maxLength^2) which is pretty slow. Although that would be the most accurate, so if you chose another algorithm then it would be probably necessary to prompt the user and ask if the command should be run.

from thefuck.

nvbn avatar nvbn commented on May 13, 2024

@cdipaolo, cool idea, thanks. I've implemented something similar, but a bit simpler.

Should be crossplatform in 1.18+.

from thefuck.

sariyamelody avatar sariyamelody commented on May 13, 2024

👍

from thefuck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.