mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Support for getting help text from a plugin command (#12243)
# Description There wasn't really a good way to implement a command group style (e.g. `from`, `query`, etc.) command in the past that just returns the help text even if `--help` is not passed. This adds a new engine call that just does that. This is actually something I ran into before when developing the dbus plugin, so it's nice to fix it. # User-Facing Changes # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting - [ ] Document `GetHelp` engine call in proto
This commit is contained in:
@ -28,11 +28,10 @@ particularly useful.
|
||||
fn run(
|
||||
&self,
|
||||
_plugin: &Self::Plugin,
|
||||
_engine: &EngineInterface,
|
||||
engine: &EngineInterface,
|
||||
call: &EvaluatedCall,
|
||||
_input: &Value,
|
||||
) -> Result<Value, LabeledError> {
|
||||
Err(LabeledError::new("No subcommand provided")
|
||||
.with_label("add --help to see a list of subcommands", call.head))
|
||||
Ok(Value::string(engine.get_help()?, call.head))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user