Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove functions from fishshell without deleting the function file directly?

Tags:

I've defined a function hello in fishshell:

function hello
    echo Hello
end

And save it:

funcsave hello

If I want to delete it, I can delete the file ~/.config/fish/functions/hello.fish.

Is there any other way to do it? (like built-in funcdel or funcrm)

like image 300
Freewind Avatar asked Apr 18 '16 16:04

Freewind


2 Answers

No, there isn't any builtin to remove the file, but you can use:

functions --erase hello

or

functions -e hello

to erase the function definition from the current session.

See also

  • Documentation
like image 107
glenn jackman Avatar answered Oct 19 '22 22:10

glenn jackman


I created another fish function for that

function funcdel
    if test -e ~/.config/fish/functions/$argv[1].fish
        rm ~/.config/fish/functions/$argv[1].fish
        echo 'Deleted function ' $argv[1]
    else
        echo 'Not found function ' $argv[1]
    end
end
like image 27
Kanzee Avatar answered Oct 19 '22 21:10

Kanzee