mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-14 00:01:16 -03:00
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.
This commit is contained in:
11
function.h
11
function.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user