In Fish shell I have two functions:
function be
bundle exec $argv
end
function rdbm
rake db:migrate
end
I typically use them together, i.e. bundle exec rake db:migrate
but not always, so I'd like to keep them separate.
The problem is that I cannot do this with the aliases I have currently defined:
To say be rdbm
expands the first function (be
) but passes rdbm
as a literal string (non-expanded).
I have also tried abbr
:
abbr be 'bundle exec'
abbr rdbm 'rake db:migrate'
But only the first expands.
I've figured out that it's possible to call functions from other functions:
function be_rdbm
echo (be rake db:migrate)
end
but this doesn't decouple the two functions, since the second is not being used.
By the way, I'd like to know if that last example can be improved. I don't see why the echo
should be necessary (or what alternatives there are), but I cannot put the parenthesis as the entire content of the function.