diff options
author | Christopher Nilsson <christopher@otherchirps.net> | 2010-09-08 03:31:05 +1000 |
---|---|---|
committer | Christopher Nilsson <christopher@otherchirps.net> | 2010-09-08 03:31:05 +1000 |
commit | 208be0f4d4f42abe8e01eae0e41e22e8ac6bae0f (patch) | |
tree | c0ae6e02445cfc86239d5b03d9ae7875004879f8 /function.h | |
parent | 1eb089d722f1b873f1db6a23da1d14fe94b50050 (diff) |
Adding '--rename' option to 'functions' builtin.
Aim is to allow an existing function to be renamed, allowing some basic function chaining.
Example:
> function foo
echo Hello
end
> foo
Hello
> functions --rename foo bar
> foo
fish: Unknown command 'foo'
> bar
Hello
> functions --rename fish_prompt old_prompt
> function fish_prompt
printf "{Boo!}%s" (old_prompt)
end
{Boo!}>
Note in the last case, the new fish_prompt is calling its old definition.
Diffstat (limited to 'function.h')
-rw-r--r-- | function.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -131,4 +131,15 @@ array_list_t *function_get_named_arguments( const wchar_t *name ); */ int function_get_shadows( const wchar_t *name ); +/** + Creates a new function using the same definition as the specified function. + Returns non-zero if copy is successful. +*/ +int function_copy( const wchar_t *name, const wchar_t *new_name ); + +/** + Renames the specified function. +*/ +void function_rename( const wchar_t *name, const wchar_t *new_name ); + #endif |