mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 21:42:01 +02:00
Add search terms to Command and Signature (#4980)
* Add search terms to command * Rename Signature desc to usage To be named uniformly with extra_usage * Throw in foldl search term for reduce * Add missing usage to post * Add search terms to signature * Try to add capnp Signature serialization
This commit is contained in:
@ -61,6 +61,11 @@ pub trait Command: Send + Sync + CommandClone {
|
||||
fn get_block_id(&self) -> Option<BlockId> {
|
||||
None
|
||||
}
|
||||
|
||||
// Related terms to help with command search
|
||||
fn search_terms(&self) -> Vec<&str> {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CommandClone {
|
||||
|
@ -11,6 +11,7 @@ use std::{
|
||||
|
||||
use crate::Value;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::path::Path;
|
||||
|
||||
#[cfg(feature = "plugin")]
|
||||
@ -527,11 +528,7 @@ impl EngineState {
|
||||
.map(|id| {
|
||||
let decl = self.get_decl(id);
|
||||
|
||||
let mut signature = (*decl).signature();
|
||||
signature.usage = decl.usage().to_string();
|
||||
signature.extra_usage = decl.extra_usage().to_string();
|
||||
|
||||
signature
|
||||
(*decl).signature().update_from_command(decl.borrow())
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@ -549,9 +546,7 @@ impl EngineState {
|
||||
.map(|id| {
|
||||
let decl = self.get_decl(id);
|
||||
|
||||
let mut signature = (*decl).signature();
|
||||
signature.usage = decl.usage().to_string();
|
||||
signature.extra_usage = decl.extra_usage().to_string();
|
||||
let signature = (*decl).signature().update_from_command(decl.borrow());
|
||||
|
||||
(
|
||||
signature,
|
||||
|
Reference in New Issue
Block a user