Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions crates/nu-command/src/network/http/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,55 +27,55 @@ impl Command for HttpDelete {
.named(
"user",
SyntaxShape::Any,
"the username when authenticating",
"The username when authenticating.",
Some('u'),
)
.named(
"password",
SyntaxShape::Any,
"the password when authenticating",
"The password when authenticating.",
Some('p'),
)
.named("data", SyntaxShape::Any, "the content to post", Some('d'))
.named("data", SyntaxShape::Any, "The content to post.", Some('d'))
.named(
"content-type",
SyntaxShape::Any,
"the MIME type of content to post",
"The MIME type of content to post.",
Some('t'),
)
.named(
"max-time",
SyntaxShape::Duration,
"max duration before timeout occurs",
"Max duration before timeout occurs.",
Some('m'),
)
.named(
"headers",
SyntaxShape::Any,
"custom headers you want to add ",
"Custom headers you want to add.",
Some('H'),
)
.switch(
"raw",
"fetch contents as text rather than a table",
"Fetch contents as text rather than a table.",
Some('r'),
)
.switch(
"insecure",
"allow insecure server connections when using SSL",
"Allow insecure server connections when using SSL.",
Some('k'),
)
.switch(
"full",
"returns the full response instead of only the body",
"Returns the full response instead of only the body.",
Some('f'),
)
.switch(
"allow-errors",
"do not fail if the server returns an error code",
"Do not fail if the server returns an error code.",
Some('e'),
)
.switch("pool", "using a global pool as a client", None)
.switch("pool", "Using a global pool as a client.", None)
.param(
Flag::new("redirect-mode")
.short('R')
Expand Down Expand Up @@ -117,37 +117,37 @@ impl Command for HttpDelete {
fn examples(&self) -> Vec<Example<'_>> {
vec![
Example {
description: "http delete from example.com",
description: "HTTP delete from example.com.",
example: "http delete https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with username and password",
description: "HTTP delete from example.com, with username and password.",
example: "http delete --user myuser --password mypass https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with custom header using a record",
description: "HTTP delete from example.com, with custom header using a record.",
example: "http delete --headers {my-header-key: my-header-value} https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with custom header using a list",
description: "HTTP delete from example.com, with custom header using a list.",
example: "http delete --headers [my-header-key-A my-header-value-A my-header-key-B my-header-value-B] https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with body",
description: "HTTP delete from example.com, with body.",
example: "http delete --data 'body' https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with JSON body",
description: "HTTP delete from example.com, with JSON body.",
example: "http delete --content-type application/json --data { field: value } https://www.example.com",
result: None,
},
Example {
description: "Perform an HTTP delete with JSON content from a pipeline to example.com",
description: "Perform an HTTP delete with JSON content from a pipeline to example.com.",
example: "open foo.json | http delete https://www.example.com",
result: None,
},
Expand Down
32 changes: 16 additions & 16 deletions crates/nu-command/src/network/http/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,48 @@ impl Command for HttpGet {
.named(
"user",
SyntaxShape::Any,
"the username when authenticating",
"The username when authenticating.",
Some('u'),
)
.named(
"password",
SyntaxShape::Any,
"the password when authenticating",
"The password when authenticating.",
Some('p'),
)
.named(
"max-time",
SyntaxShape::Duration,
"max duration before timeout occurs",
"Max duration before timeout occurs.",
Some('m'),
)
.named(
"headers",
SyntaxShape::Any,
"custom headers you want to add ",
"Custom headers you want to add.",
Some('H'),
)
.switch(
"raw",
"fetch contents as text rather than a table",
"Fetch contents as text rather than a table.",
Some('r'),
)
.switch(
"insecure",
"allow insecure server connections when using SSL",
"Allow insecure server connections when using SSL.",
Some('k'),
)
.switch(
"full",
"returns the full response instead of only the body",
"Returns the full response instead of only the body.",
Some('f'),
)
.switch(
"allow-errors",
"do not fail if the server returns an error code",
"Do not fail if the server returns an error code.",
Some('e'),
)
.switch("pool", "using a global pool as a client", None)
.switch("pool", "Using a global pool as a client.", None)
.param(
Flag::new("redirect-mode")
.short('R')
Expand Down Expand Up @@ -113,37 +113,37 @@ impl Command for HttpGet {
fn examples(&self) -> Vec<Example<'_>> {
vec![
Example {
description: "Get content from example.com",
description: "Get content from example.com.",
example: "http get https://www.example.com",
result: None,
},
Example {
description: "Get content from example.com, with username and password",
description: "Get content from example.com, with username and password.",
example: "http get --user myuser --password mypass https://www.example.com",
result: None,
},
Example {
description: "Get content from example.com, with custom header using a record",
description: "Get content from example.com, with custom header using a record.",
example: "http get --headers {my-header-key: my-header-value} https://www.example.com",
result: None,
},
Example {
description: "Get content from example.com, with custom headers using a list",
description: "Get content from example.com, with custom headers using a list.",
example: "http get --headers [my-header-key-A my-header-value-A my-header-key-B my-header-value-B] https://www.example.com",
result: None,
},
Example {
description: "Get the response status code",
description: "Get the response status code.",
example: r#"http get https://www.example.com | metadata | get http_response.status"#,
result: None,
},
Example {
description: "Check response status while streaming",
description: "Check response status while streaming.",
example: r#"http get --allow-errors https://example.com/file | metadata access {|m| if $m.http_response.status != 200 { error make {msg: "failed"} } else { } } | lines"#,
result: None,
},
Example {
description: "Get from Docker daemon via Unix socket",
description: "Get from Docker daemon via Unix socket.",
example: "http get --unix-socket /var/run/docker.sock http://localhost/containers/json",
result: None,
},
Expand Down
20 changes: 10 additions & 10 deletions crates/nu-command/src/network/http/head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@ impl Command for HttpHead {
.named(
"user",
SyntaxShape::Any,
"the username when authenticating",
"The username when authenticating.",
Some('u'),
)
.named(
"password",
SyntaxShape::Any,
"the password when authenticating",
"The password when authenticating.",
Some('p'),
)
.named(
"max-time",
SyntaxShape::Duration,
"max duration before timeout occurs",
"Max duration before timeout occurs.",
Some('m'),
)
.named(
"headers",
SyntaxShape::Any,
"custom headers you want to add ",
"Custom headers you want to add.",
Some('H'),
)
.switch(
"insecure",
"allow insecure server connections when using SSL",
"Allow insecure server connections when using SSL.",
Some('k'),
)
.switch("pool", "using a global pool as a client", None)
.switch("pool", "Using a global pool as a client.", None)
.param(
Flag::new("redirect-mode")
.short('R')
Expand Down Expand Up @@ -95,22 +95,22 @@ impl Command for HttpHead {
fn examples(&self) -> Vec<Example<'_>> {
vec![
Example {
description: "Get headers from example.com",
description: "Get headers from example.com.",
example: "http head https://www.example.com",
result: None,
},
Example {
description: "Get headers from example.com, with username and password",
description: "Get headers from example.com, with username and password.",
example: "http head --user myuser --password mypass https://www.example.com",
result: None,
},
Example {
description: "Get headers from example.com, with custom header using a record",
description: "Get headers from example.com, with custom header using a record.",
example: "http head --headers {my-header-key: my-header-value} https://www.example.com",
result: None,
},
Example {
description: "Get headers from example.com, with custom header using a list",
description: "Get headers from example.com, with custom header using a list.",
example: "http head --headers [my-header-key-A my-header-value-A my-header-key-B my-header-value-B] https://www.example.com",
result: None,
},
Expand Down
22 changes: 11 additions & 11 deletions crates/nu-command/src/network/http/http_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,42 @@ impl Command for Http {
.named(
"content-type",
SyntaxShape::Any,
"the MIME type of content to post",
"The MIME type of content to post.",
Some('t'),
)
// common
.named(
"user",
SyntaxShape::Any,
"the username when authenticating",
"The username when authenticating.",
Some('u'),
)
.named(
"password",
SyntaxShape::Any,
"the password when authenticating",
"The password when authenticating.",
Some('p'),
)
.named(
"max-time",
SyntaxShape::Duration,
"max duration before timeout occurs",
"Max duration before timeout occurs.",
Some('m'),
)
.named(
"headers",
SyntaxShape::Any,
"custom headers you want to add ",
"Custom headers you want to add.",
Some('H'),
)
.switch(
"raw",
"fetch contents as text rather than a table",
"Fetch contents as text rather than a table.",
Some('r'),
)
.switch(
"insecure",
"allow insecure server connections when using SSL",
"Allow insecure server connections when using SSL.",
Some('k'),
)
.switch(
Expand All @@ -82,7 +82,7 @@ impl Command for Http {
)
.switch(
"allow-errors",
"do not fail if the server returns an error code",
"Do not fail if the server returns an error code.",
Some('e'),
)
.param(
Expand Down Expand Up @@ -154,17 +154,17 @@ impl Command for Http {
fn examples(&self) -> Vec<Example<'_>> {
vec![
Example {
description: "Get content from example.com with default verb",
description: "Get content from example.com with default verb.",
example: "http https://www.example.com",
result: None,
},
Example {
description: "Post content to example.com with default verb",
description: "Post content to example.com with default verb.",
example: "http https://www.example.com 'body'",
result: None,
},
Example {
description: "Get content from example.com with explicit verb",
description: "Get content from example.com with explicit verb.",
example: "http get https://www.example.com",
result: None,
},
Expand Down
Loading
Loading