mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
List time as builtin, support time --help
`a=b time foo` will no longer call an external `time` command (like it does in bash). Fixes #6598
This commit is contained in:
parent
4fba8022a9
commit
7ef7f93a90
|
@ -394,6 +394,7 @@ static const builtin_data_t builtin_datas[] = {
|
|||
{L"string", &builtin_string, N_(L"Manipulate strings")},
|
||||
{L"switch", &builtin_generic, N_(L"Conditionally execute a block of commands")},
|
||||
{L"test", &builtin_test, N_(L"Test a condition")},
|
||||
{L"time", &builtin_generic, N_(L"Measure how long a command or block takes")},
|
||||
{L"true", &builtin_true, N_(L"Return a successful result")},
|
||||
{L"ulimit", &builtin_ulimit, N_(L"Set or get the shells resource usage limits")},
|
||||
{L"wait", &builtin_wait, N_(L"Wait for background processes completed")},
|
||||
|
|
|
@ -397,16 +397,12 @@ RESOLVE(optional_background) {
|
|||
}
|
||||
|
||||
RESOLVE(optional_time) {
|
||||
UNUSED(token2);
|
||||
|
||||
switch (token1.keyword) {
|
||||
case parse_keyword_time:
|
||||
*out_tag = parse_optional_time_time;
|
||||
return production_for<time>();
|
||||
default:
|
||||
*out_tag = parse_optional_time_no_time;
|
||||
return production_for<empty>();
|
||||
if (token1.keyword == parse_keyword_time && !token2.is_help_argument) {
|
||||
*out_tag = parse_optional_time_time;
|
||||
return production_for<time>();
|
||||
}
|
||||
*out_tag = parse_optional_time_no_time;
|
||||
return production_for<empty>();
|
||||
}
|
||||
|
||||
const production_element_t *parse_productions::production_for_token(parse_token_type_t node_type,
|
||||
|
|
|
@ -32,12 +32,6 @@ true && time a=b not builtin true | true
|
|||
#CHECKERR: {{.*}}
|
||||
#CHECKERR: {{.*}}
|
||||
|
||||
PATH= time true
|
||||
#CHECKERR: fish: Unknown command: time
|
||||
#CHECKERR: {{.*}}
|
||||
#CHECKERR: PATH= time true
|
||||
#CHECKERR: ^
|
||||
|
||||
not time true
|
||||
#CHECKERR: ___{{.*}}
|
||||
#CHECKERR: {{.*}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user