`functions -e` works just fine for me. But may I make one minor tweak:

# .config/fish/config.fish
functions -e (hostname)

-Kevin

On Jun 27, 2012, at 12:30 AM, Christopher Wright <dhase...@gmail.com> wrote:

> Try this pattern:
> 
> # .config/fish/functions/mybox.fish
> function mybox
>  ssh mybox.example.com $argv
> end
> 
> # .config/fish/config.fish
> if test (hostname) == "mybox"
>  functions -e mybox
> end
> 
> ...except for `functions -e` not working yet (at least for me; am I on 
> master?).
> 
> Quoting Elis Axelsson (2012-06-26 09:37:27)
>> Hello fishermans ;)
>> 
>> In my case, I have a repo for my home-folder. Which I have on almost
>> all my boxes to keep my configs synced. I also like to make "aliases"
>> for ssh to some different boxes, so I just type the name of the box in
>> my fish and I get there.
>> 
>> And It's very very rare that I want to ssh to localhost, so I fired up
>> a texteditor and added if-statements depending on hostname to make a
>> function or not in my ~/.config/fish/function/*fish files... like
>> this:
>> if test (hostname) != "mybox"
>>   function mybox
>>       ssh mybox.example.com $argv
>>   end
>> end
>> 
>> This works well, until I want to funced that function on any box, I
>> have to do it by hand in the file. The inline-editor does not do it
>> for me if I have if-statement outside of the function-declaration. But
>> that's fine.
>> 
>> So to my suggestion:
>> 
>> To introduce --hosts on function
>> 
>> And that you can have multiple hosts separated by comma and that you
>> can have wildcard * for any host, and have like "!myhost42" to say
>> "don't make this function available on hosts with the name myhost42"
>> 
>> Like this:
>> 
>> function mybox --hosts *,!mybox
>> ssh mybox.example.com $argv
>> end
>> 
>> -- 
>> Elis "etu" Axelsson
>> 
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and 
>> threat landscape has changed and how IT managers can respond. Discussions 
>> will include endpoint security, mobile security and the latest in malware 
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Fish-users mailing list
>> Fish-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/fish-users
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to