From c4bd110fcae7ae2b132905f4af5b5496f1c83b19 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Fri, 28 Oct 2016 22:29:02 -0700 Subject: [PATCH] List alias-created functions on `alias` sans args The previous change I made here makes this not hard to do, but kind of lame in implementation. --- share/functions/alias.fish | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/share/functions/alias.fish b/share/functions/alias.fish index 811214c1d..86a1e702e 100644 --- a/share/functions/alias.fish +++ b/share/functions/alias.fish @@ -1,4 +1,4 @@ -function alias --description 'Legacy function for creating shellscript functions using an alias-like syntax' +function alias --description 'Creates a function wrapping a command' if count $argv > /dev/null switch $argv[1] case -h --h --he --hel --help @@ -14,8 +14,10 @@ function alias --description 'Legacy function for creating shellscript functions switch (count $argv) case 0 - echo "Fish implements aliases using functions. Use 'functions' builtin to see list of functions and 'functions function_name' to see function definition, type 'help alias' for more information." - return 1 + for func in (functions -n) + functions $func | string match -- "function * --description 'alias *" | string replace -r -- "function .* --description '" ''| string trim -c\' + end + return 0 case 1 set -l tmp (string replace -r "=" '\n' -- $argv) "" set name $tmp[1]