Add command-not-found handler for Arch Linux #1925

Merged
merged 1 commit into from Feb 1, 2015

Conversation

Projects
None yet
6 participants
@beatgammit
Contributor

beatgammit commented Jan 31, 2015

Arch Linux does not ship with a command-not-found handler, but pkgfile provides the needed functionality and example command-not-found handlers in Bash.

I thought about adding a check for Arch Linux if pkgfile isn't available and recommending installing that package (only once, not every time), but that seems a bit over-the-top for such simple functionality. If you think this would be acceptable and beneficial, I can implement that as well.

Add command-not-found handler for Arch Linux
- checks for `pkgfile`, which is an optional (but official)
  package used for searching for packages given a file
@xfix

This comment has been minimized.

Show comment
Hide comment
@xfix

xfix Feb 1, 2015

Member

There is no need for recommending, I believe that the package maintainer could be just told to set pkgfile as optional dependency for fish shell.

Member

xfix commented Feb 1, 2015

There is no need for recommending, I believe that the package maintainer could be just told to set pkgfile as optional dependency for fish shell.

@xfix xfix merged commit 793784c into fish-shell:master Feb 1, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@zanchey zanchey added this to the next-minor milestone Feb 1, 2015

@ShyPixie

This comment has been minimized.

Show comment
Hide comment
@ShyPixie

ShyPixie Aug 24, 2015

I use archlinux in raspberrypi and this causes all commands executed to run extremely slow. I use pkgfile but this function is bad in my case. I can to set an empty function for __fish_command_not_found_handler, but it looks pretty ugly.You might have an option or setting variable for disable this feature if necessary.

I use archlinux in raspberrypi and this causes all commands executed to run extremely slow. I use pkgfile but this function is bad in my case. I can to set an empty function for __fish_command_not_found_handler, but it looks pretty ugly.You might have an option or setting variable for disable this feature if necessary.

@faho

This comment has been minimized.

Show comment
Hide comment
@faho

faho Aug 24, 2015

Member

I use archlinux in raspberrypi and this causes all commands executed to run extremely slow.

What do you mean? All commands, including those that actually execute, or just those where the command isn't found? The former would be a bug (so please open an issue for that), the latter is (unfortunately) expected.

I can to set an empty function for __fish_command_not_found_handler, but it looks pretty ugly.You might have an option or setting variable for disable this feature if necessary.

Quite frankly, I believe exposing tons of special variables is even uglier.

Now, what I'd agree to, unless there's something I'm just not seeing, is to make overriding __fish_command_not_found_handler actually work - currently it doesn't, because it is deleted and then overwritten in __fish_command_not_found_setup (in __fish_config_interactive.fish). I'll try to find out why the current solution does that, to me it looks a bit overzealous.

Member

faho commented Aug 24, 2015

I use archlinux in raspberrypi and this causes all commands executed to run extremely slow.

What do you mean? All commands, including those that actually execute, or just those where the command isn't found? The former would be a bug (so please open an issue for that), the latter is (unfortunately) expected.

I can to set an empty function for __fish_command_not_found_handler, but it looks pretty ugly.You might have an option or setting variable for disable this feature if necessary.

Quite frankly, I believe exposing tons of special variables is even uglier.

Now, what I'd agree to, unless there's something I'm just not seeing, is to make overriding __fish_command_not_found_handler actually work - currently it doesn't, because it is deleted and then overwritten in __fish_command_not_found_setup (in __fish_config_interactive.fish). I'll try to find out why the current solution does that, to me it looks a bit overzealous.

@faho

This comment has been minimized.

Show comment
Hide comment
Member

faho commented Aug 24, 2015

@pickfire

This comment has been minimized.

Show comment
Hide comment
@pickfire

pickfire Aug 25, 2015

Contributor

I use archlinux in raspberrypi and this causes all commands executed to run extremely slow.

I use arch linux in raspberry pi 2, it seems that fish is a lot faster than zsh, I hope that it can still improve the start up time which is almost 2 seconds.

Contributor

pickfire commented Aug 25, 2015

I use archlinux in raspberrypi and this causes all commands executed to run extremely slow.

I use arch linux in raspberry pi 2, it seems that fish is a lot faster than zsh, I hope that it can still improve the start up time which is almost 2 seconds.

faho added a commit that referenced this pull request Aug 31, 2015

Make overriding cnf-handler work
See #1925: This allows users to disable the cnf-logic which can be quite
slow on small hardware (like a raspberry pi).

Squashed commit of the following:

commit 742a59e30d8db24b6bb5067d4204d4b5cc01c1c3
Author: Fabian Homborg <FHomborg@gmail.com>
Date:   Sun Aug 30 18:23:41 2015 +0200

    Erase startup cnf-handler early

    Simplifies the code a bit - in particular it removes the special-casing
    from the startup handler.

commit 638a97e7f31f302b65e044c93c638c03a69e31f5
Author: Fabian Homborg <FHomborg@gmail.com>
Date:   Mon Aug 24 20:14:46 2015 +0200

    Make overriding cnf-handler work

    Do this by renaming the __fish_command_not_found_handler used during
    startup to __fish_startup_command_not_found_handler. That allows us to
    check if __fish_command_not_found_handler has been defined and skip the
    setup of the normal one.

    Now disabling cnf-handling can be done via defining an empty
    __fish_command_not_found_handler in config.fish

faho added a commit to faho/fish-shell that referenced this pull request Sep 8, 2015

Make overriding cnf-handler work
See #1925: This allows users to disable the cnf-logic which can be quite
slow on small hardware (like a raspberry pi).

Squashed commit of the following:

commit 742a59e30d8db24b6bb5067d4204d4b5cc01c1c3
Author: Fabian Homborg <FHomborg@gmail.com>
Date:   Sun Aug 30 18:23:41 2015 +0200

    Erase startup cnf-handler early

    Simplifies the code a bit - in particular it removes the special-casing
    from the startup handler.

commit 638a97e7f31f302b65e044c93c638c03a69e31f5
Author: Fabian Homborg <FHomborg@gmail.com>
Date:   Mon Aug 24 20:14:46 2015 +0200

    Make overriding cnf-handler work

    Do this by renaming the __fish_command_not_found_handler used during
    startup to __fish_startup_command_not_found_handler. That allows us to
    check if __fish_command_not_found_handler has been defined and skip the
    setup of the normal one.

    Now disabling cnf-handling can be done via defining an empty
    __fish_command_not_found_handler in config.fish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment