Make get_full_help take &dyn Command (#12903)

# Description
Changes `get_full_help` to take a `&dyn Command` instead of multiple
arguments (`&Signature`, `&Examples` `is_parser_keyword`). All of these
arguments can be gathered from a `Command`, so there is no need to pass
the pieces to `get_full_help`.

This PR also fixes an issue where the search terms are not shown if
`--help` is used on a command.
This commit is contained in:
Ian Manske
2024-05-19 17:56:33 +00:00
committed by GitHub
parent 474293bf1c
commit baeba19b22
36 changed files with 82 additions and 413 deletions

View File

@ -42,26 +42,6 @@ impl Command for Date {
call: &Call,
_input: PipelineData,
) -> Result<PipelineData, ShellError> {
date(engine_state, stack, call)
Ok(Value::string(get_full_help(self, engine_state, stack), call.head).into_pipeline_data())
}
}
fn date(
engine_state: &EngineState,
stack: &mut Stack,
call: &Call,
) -> Result<PipelineData, ShellError> {
let head = call.head;
Ok(Value::string(
get_full_help(
&Date.signature(),
&Date.examples(),
engine_state,
stack,
false,
),
head,
)
.into_pipeline_data())
}