mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Do not show function body as description in output of the functions builtin
darcs-hash:20060123233213-ac50b-6887d4a2a9536e0697ab5ed0b1277dc645018cb9.gz
This commit is contained in:
parent
29c488c6dc
commit
ba177b48d5
13
complete.c
13
complete.c
|
@ -1216,6 +1216,17 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
|
||||||
free( apropos_cmd );
|
free( apropos_cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const wchar_t *complete_function_desc( const wchar_t *fn )
|
||||||
|
{
|
||||||
|
const wchar_t *res = function_get_desc( fn );
|
||||||
|
|
||||||
|
if( !res )
|
||||||
|
res = function_get_definition( fn );
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Complete the specified command name. Search for executables in the
|
Complete the specified command name. Search for executables in the
|
||||||
path, executables defined using an absolute path, functions,
|
path, executables defined using an absolute path, functions,
|
||||||
|
@ -1295,7 +1306,7 @@ static void complete_cmd( const wchar_t *cmd,
|
||||||
|
|
||||||
al_init( &possible_comp );
|
al_init( &possible_comp );
|
||||||
function_get_names( &possible_comp, cmd[0] == L'_' );
|
function_get_names( &possible_comp, cmd[0] == L'_' );
|
||||||
copy_strings_with_prefix( comp, cmd, COMPLETE_FUNCTION_DESC, &function_get_desc, &possible_comp );
|
copy_strings_with_prefix( comp, cmd, COMPLETE_FUNCTION_DESC, &complete_function_desc, &possible_comp );
|
||||||
al_truncate( &possible_comp, 0 );
|
al_truncate( &possible_comp, 0 );
|
||||||
|
|
||||||
builtin_get_names( &possible_comp );
|
builtin_get_names( &possible_comp );
|
||||||
|
|
|
@ -136,7 +136,7 @@ const wchar_t *function_get_desc( const wchar_t *argv )
|
||||||
if( data == 0 )
|
if( data == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return data->desc?data->desc:data->cmd;
|
return data->desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void function_set_desc( const wchar_t *name, const wchar_t *desc )
|
void function_set_desc( const wchar_t *name, const wchar_t *desc )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user