mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +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:
@ -4,6 +4,8 @@ use nu_protocol::{
|
||||
engine::{EngineState, Stack},
|
||||
Example, IntoPipelineData, Signature, Span, Value,
|
||||
};
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::HashMap;
|
||||
|
||||
const COMMANDS_DOCS_DIR: &str = "docs/commands";
|
||||
@ -51,10 +53,12 @@ fn generate_doc(
|
||||
});
|
||||
}
|
||||
|
||||
let signature = command.signature().update_from_command(command.borrow());
|
||||
|
||||
cols.push("documentation".to_owned());
|
||||
vals.push(Value::String {
|
||||
val: get_documentation(
|
||||
&command.signature(),
|
||||
&signature,
|
||||
&command.examples(),
|
||||
engine_state,
|
||||
stack,
|
||||
@ -177,6 +181,13 @@ pub fn get_documentation(
|
||||
}
|
||||
}
|
||||
|
||||
if !sig.search_terms.is_empty() {
|
||||
long_desc.push_str(&format!(
|
||||
"Search terms: {}\n\n",
|
||||
sig.search_terms.join(", ")
|
||||
));
|
||||
}
|
||||
|
||||
long_desc.push_str(&format!("Usage:\n > {}\n", sig.call_signature()));
|
||||
|
||||
if !subcommands.is_empty() {
|
||||
|
Reference in New Issue
Block a user