mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 12:58:11 +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:
@ -27,7 +27,6 @@ impl Command for SubCommand {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("fetch")
|
||||
.desc("Load from a URL into a cell, convert to table if possible (avoid by appending '--raw').")
|
||||
.required(
|
||||
"URL",
|
||||
SyntaxShape::String,
|
||||
@ -45,15 +44,33 @@ impl Command for SubCommand {
|
||||
"the password when authenticating",
|
||||
Some('p'),
|
||||
)
|
||||
.named("timeout", SyntaxShape::Int, "timeout period in seconds", Some('t'))
|
||||
.named("headers",SyntaxShape::Any, "custom headers you want to add ", Some('H'))
|
||||
.switch("raw", "fetch contents as text rather than a table", Some('r'))
|
||||
.named(
|
||||
"timeout",
|
||||
SyntaxShape::Int,
|
||||
"timeout period in seconds",
|
||||
Some('t'),
|
||||
)
|
||||
.named(
|
||||
"headers",
|
||||
SyntaxShape::Any,
|
||||
"custom headers you want to add ",
|
||||
Some('H'),
|
||||
)
|
||||
.switch(
|
||||
"raw",
|
||||
"fetch contents as text rather than a table",
|
||||
Some('r'),
|
||||
)
|
||||
.filter()
|
||||
.category(Category::Network)
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Fetch the contents from a URL (HTTP GET operation)."
|
||||
"Fetch the contents from a URL."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"Performs HTTP GET operation."
|
||||
}
|
||||
|
||||
fn run(
|
||||
|
@ -24,7 +24,6 @@ impl Command for SubCommand {
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("post")
|
||||
.desc("Post content to a URL and retrieve data as a table if possible.")
|
||||
.required("path", SyntaxShape::String, "the URL to post to")
|
||||
.required("body", SyntaxShape::Any, "the contents of the post body")
|
||||
.named(
|
||||
@ -70,9 +69,15 @@ impl Command for SubCommand {
|
||||
.filter()
|
||||
.category(Category::Network)
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Post a body to a URL (HTTP POST operation)."
|
||||
"Post a body to a URL."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"Performs HTTP POST operation."
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
engine_state: &EngineState,
|
||||
|
Reference in New Issue
Block a user