Add long options for misc and network (#10753)

This commit is contained in:
Hofer-Julian 2023-10-19 18:16:44 +02:00 committed by GitHub
parent adb99938f7
commit 5f2089a15b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 26 deletions

View File

@ -60,7 +60,7 @@ impl Command for Tutor {
},
Example {
description: "Search a tutorial by phrase",
example: "tutor -f \"$in\"",
example: "tutor --find \"$in\"",
result: None,
},
]

View File

@ -115,23 +115,23 @@ impl Command for SubCommand {
},
Example {
description: "http delete from example.com, with username and password",
example: "http delete -u myuser -p mypass https://www.example.com",
example: "http delete --user myuser --password mypass https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with custom header",
example: "http delete -H [my-header-key my-header-value] https://www.example.com",
example: "http delete --headers [my-header-key my-header-value] https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with body",
example: "http delete -d 'body' https://www.example.com",
example: "http delete --data 'body' https://www.example.com",
result: None,
},
Example {
description: "http delete from example.com, with JSON body",
example:
"http delete -t application/json -d { field: value } https://www.example.com",
"http delete --content-type application/json --data { field: value } https://www.example.com",
result: None,
},
]

View File

@ -110,17 +110,17 @@ impl Command for SubCommand {
},
Example {
description: "Get content from example.com, with username and password",
example: "http get -u myuser -p mypass https://www.example.com",
example: "http get --user myuser --password mypass https://www.example.com",
result: None,
},
Example {
description: "Get content from example.com, with custom header",
example: "http get -H [my-header-key my-header-value] https://www.example.com",
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",
example: "http get -H [my-header-key-A my-header-value-A my-header-key-B my-header-value-B] https://www.example.com",
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,
},
]

View File

@ -94,12 +94,13 @@ impl Command for SubCommand {
},
Example {
description: "Get headers from example.com, with username and password",
example: "http head -u myuser -p mypass https://www.example.com",
example: "http head --user myuser --password mypass https://www.example.com",
result: None,
},
Example {
description: "Get headers from example.com, with custom header",
example: "http head -H [my-header-key my-header-value] https://www.example.com",
example:
"http head --headers [my-header-key my-header-value] https://www.example.com",
result: None,
},
]

View File

@ -98,22 +98,22 @@ impl Command for SubCommand {
},
Example {
description: "Get options from example.com, with username and password",
example: "http options -u myuser -p mypass https://www.example.com",
example: "http options --user myuser --password mypass https://www.example.com",
result: None,
},
Example {
description: "Get options from example.com, with custom header",
example: "http options -H [my-header-key my-header-value] https://www.example.com",
example: "http options --headers [my-header-key my-header-value] https://www.example.com",
result: None,
},
Example {
description: "Get options from example.com, with custom headers",
example: "http options -H [my-header-key-A my-header-value-A my-header-key-B my-header-value-B] https://www.example.com",
example: "http options --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: "Simulate a browser cross-origin preflight request from www.example.com to media.example.com",
example: "http options https://media.example.com/api/ -H [Origin https://www.example.com Access-Control-Request-Headers \"Content-Type, X-Custom-Header\" Access-Control-Request-Method GET]",
example: "http options https://media.example.com/api/ --headers [Origin https://www.example.com Access-Control-Request-Headers \"Content-Type, X-Custom-Header\" Access-Control-Request-Method GET]",
result: None,
},
]

View File

@ -111,17 +111,19 @@ impl Command for SubCommand {
},
Example {
description: "Patch content to example.com, with username and password",
example: "http patch -u myuser -p mypass https://www.example.com 'body'",
example:
"http patch --user myuser --password mypass https://www.example.com 'body'",
result: None,
},
Example {
description: "Patch content to example.com, with custom header",
example: "http patch -H [my-header-key my-header-value] https://www.example.com",
example:
"http patch --headers [my-header-key my-header-value] https://www.example.com",
result: None,
},
Example {
description: "Patch content to example.com, with JSON body",
example: "http patch -t application/json https://www.example.com { field: value }",
example: "http patch --content-type application/json https://www.example.com { field: value }",
result: None,
},
]

View File

@ -111,17 +111,17 @@ impl Command for SubCommand {
},
Example {
description: "Post content to example.com, with username and password",
example: "http post -u myuser -p mypass https://www.example.com 'body'",
example: "http post --user myuser --password mypass https://www.example.com 'body'",
result: None,
},
Example {
description: "Post content to example.com, with custom header",
example: "http post -H [my-header-key my-header-value] https://www.example.com",
example: "http post --headers [my-header-key my-header-value] https://www.example.com",
result: None,
},
Example {
description: "Post content to example.com, with JSON body",
example: "http post -t application/json https://www.example.com { field: value }",
example: "http post --content-type application/json https://www.example.com { field: value }",
result: None,
},
]

View File

@ -111,17 +111,17 @@ impl Command for SubCommand {
},
Example {
description: "Put content to example.com, with username and password",
example: "http put -u myuser -p mypass https://www.example.com 'body'",
example: "http put --user myuser --password mypass https://www.example.com 'body'",
result: None,
},
Example {
description: "Put content to example.com, with custom header",
example: "http put -H [my-header-key my-header-value] https://www.example.com",
example: "http put --headers [my-header-key my-header-value] https://www.example.com",
result: None,
},
Example {
description: "Put content to example.com, with JSON body",
example: "http put -t application/json https://www.example.com { field: value }",
example: "http put --content-type application/json https://www.example.com { field: value }",
result: None,
},
]

View File

@ -72,17 +72,17 @@ impl Plugin for Query {
pub fn web_examples() -> Vec<PluginExample> {
vec![PluginExample {
example: "http get https://phoronix.com | query web -q 'header'".into(),
example: "http get https://phoronix.com | query web --query 'header'".into(),
description: "Retrieve all `<header>` elements from phoronix.com website".into(),
result: None,
}, PluginExample {
example: "http get https://en.wikipedia.org/wiki/List_of_cities_in_India_by_population
| query web -t [Rank City 'Population(2011)[3]' 'Population(2001)[3][a]' 'State or union territory']".into(),
| query web --as-table [Rank City 'Population(2011)[3]' 'Population(2001)[3][a]' 'State or union territory']".into(),
description: "Retrieve a html table from Wikipedia and parse it into a nushell table using table headers as guides".into(),
result: None
},
PluginExample {
example: "http get https://www.nushell.sh | query web -q 'h2, h2 + p' | group 2 | each {rotate --ccw tagline description} | flatten".into(),
example: "http get https://www.nushell.sh | query web --query 'h2, h2 + p' | group 2 | each {rotate --ccw tagline description} | flatten".into(),
description: "Pass multiple css selectors to extract several elements within single query, group the query results together and rotate them to create a table".into(),
result: None,
},