Can I make an alias for `set -l` in the fish shell? -


i make liberal use of set -l/set --local in fish scripts, considered making alias it. name local seems apt. unfortunately, obvious approach doesn't work:

function local   set -l $argv end 

this fails because, of course, variable creates local local function itself. using alias doesn't work, either, since it's (perhaps legacy) shorthand above function.

is there way can create local variable in calling scope without doing more complicated local foo 'bar'? make eval (local foo 'bar') work, sort of defeat purpose. i'm open sort of trickery or hacks make work, if exist.

i'm afraid not, local variables local topmost scope, , there's no way wrap set without creating new scope. best can this:

function def --no-scope-shadowing     set $argv  end 

this creates variable in calling function scope. subtly different local: local scoped block, while above scoped function. still may sufficient use case.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -