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:
Jakub Žádník
2022-03-27 22:25:30 +03:00
committed by GitHub
parent 0c9dd6a29a
commit 2873e943b3
32 changed files with 269 additions and 100 deletions

View File

@ -129,7 +129,7 @@ fn display(model: &Model) -> Result<(), Box<dyn Error>> {
impl Plugin for SubCommand {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("chart bar")
.desc("Bar charts")
.usage("Bar charts")
.switch("acc", "accumulate values", Some('a'))
.optional(
"columns",

View File

@ -127,7 +127,7 @@ fn display(model: &Model) -> Result<(), Box<dyn Error>> {
impl Plugin for SubCommand {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("chart line")
.desc("Line charts")
.usage("Line charts")
.switch("acc", "accumulate values", Some('a'))
.optional(
"columns",

View File

@ -10,7 +10,7 @@ use nu_source::Tag;
impl Plugin for FromBson {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("from bson")
.desc("Convert from .bson binary into table")
.usage("Convert from .bson binary into table")
.filter())
}

View File

@ -10,7 +10,7 @@ use nu_source::Tag;
impl Plugin for FromMp4 {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("from mp4")
.desc("Get meta-data of mp4 file")
.usage("Get meta-data of mp4 file")
.filter())
}

View File

@ -33,7 +33,7 @@ impl Plugin for FromSqlite {
"Only convert specified tables",
Some('t'),
)
.desc("Convert from sqlite binary into table")
.usage("Convert from sqlite binary into table")
.filter())
}

View File

@ -9,7 +9,7 @@ use crate::handler::s3_helper;
impl Plugin for handler::Handler {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("s3")
.desc("Load S3 resource into a cell, convert to table if possible (avoid by appending '--raw' or '-R')")
.usage("Load S3 resource into a cell, convert to table if possible (avoid by appending '--raw' or '-R')")
.required(
"RESOURCE",
SyntaxShape::String,

View File

@ -7,7 +7,7 @@ use crate::start::Start;
impl Plugin for Start {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("start")
.desc("Opens each file/directory/URL using the default application")
.usage("Opens each file/directory/URL using the default application")
.rest(
"rest",
SyntaxShape::String,

View File

@ -10,7 +10,7 @@ use nu_source::Tag;
impl Plugin for ToBson {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("to bson")
.desc("Convert table into .bson binary")
.usage("Convert table into .bson binary")
.filter())
}

View File

@ -10,7 +10,7 @@ use nu_source::Tag;
impl Plugin for ToSqlite {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("to sqlite")
.desc("Convert table into sqlite binary")
.usage("Convert table into sqlite binary")
.filter())
}

View File

@ -7,7 +7,7 @@ use crate::TreeViewer;
impl Plugin for TreeViewer {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("tree").desc("View the contents of the pipeline as a tree."))
Ok(Signature::build("tree").usage("View the contents of the pipeline as a tree."))
}
fn sink(&mut self, _call_info: CallInfo, input: Vec<Value>) {