mirror of
https://github.com/nushell/nushell.git
synced 2025-08-17 23:09:51 +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:
@@ -447,6 +447,8 @@ pub enum EngineCall<D> {
|
||||
GetCurrentDir,
|
||||
/// Set an environment variable in the caller's scope
|
||||
AddEnvVar(String, Value),
|
||||
/// Get help for the current command
|
||||
GetHelp,
|
||||
/// Evaluate a closure with stream input/output
|
||||
EvalClosure {
|
||||
/// The closure to call.
|
||||
@@ -474,6 +476,7 @@ impl<D> EngineCall<D> {
|
||||
EngineCall::GetEnvVars => "GetEnvs",
|
||||
EngineCall::GetCurrentDir => "GetCurrentDir",
|
||||
EngineCall::AddEnvVar(..) => "AddEnvVar",
|
||||
EngineCall::GetHelp => "GetHelp",
|
||||
EngineCall::EvalClosure { .. } => "EvalClosure",
|
||||
}
|
||||
}
|
||||
@@ -491,6 +494,7 @@ impl<D> EngineCall<D> {
|
||||
EngineCall::GetEnvVars => EngineCall::GetEnvVars,
|
||||
EngineCall::GetCurrentDir => EngineCall::GetCurrentDir,
|
||||
EngineCall::AddEnvVar(name, value) => EngineCall::AddEnvVar(name, value),
|
||||
EngineCall::GetHelp => EngineCall::GetHelp,
|
||||
EngineCall::EvalClosure {
|
||||
closure,
|
||||
positional,
|
||||
|
Reference in New Issue
Block a user