Merge pull request #82 from jonathandturner/rename_select

Rename select
This commit is contained in:
Jonathan Turner 2019-06-05 13:57:59 +12:00 committed by GitHub
commit 02e6ee6991
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 12 additions and 12 deletions

View file

@ -21,7 +21,7 @@ At the moment, executing a command that isn't identified as a built-in new comma
| ------------- | ------------- | | ------------- | ------------- |
| pick ...columns | Down-select table to only these columns | | pick ...columns | Down-select table to only these columns |
| reject ...columns | Remove the given columns from the table | | reject ...columns | Remove the given columns from the table |
| select column-or-column-path | Open given cells as text | | get column-or-column-path | Open given cells as text |
| sort-by ...columns | Sort by the given columns | | sort-by ...columns | Sort by the given columns |
| where condition | Filter table to match the condition | | where condition | Filter table to match the condition |
| skip amount | Skip a number of rows | | skip amount | Skip a number of rows |
@ -159,7 +159,7 @@ Some file types can be loaded as tables.
[object Object] [object Object] [object Object] [object Object] [object Object] [object Object]
---------------------------------------------------- ----------------------------------------------------
~\Code\nushell> open Cargo.toml | select package ~\Code\nushell> open Cargo.toml | get package
-------------------------------------------------------------------------- --------------------------------------------------------------------------
authors description edition license name version authors description edition license name version
-------------------------------------------------------------------------- --------------------------------------------------------------------------
@ -170,7 +170,7 @@ Some file types can be loaded as tables.
Once you've found the data, you can call out to external applications and use it. Once you've found the data, you can call out to external applications and use it.
```text ```text
~\Code\nushell> open Cargo.toml | select package.version | echo $it ~\Code\nushell> open Cargo.toml | get package.version | echo $it
0.1.1 0.1.1
``` ```

View file

@ -54,12 +54,12 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
command("from-json", from_json::from_json), command("from-json", from_json::from_json),
command("from-toml", from_toml::from_toml), command("from-toml", from_toml::from_toml),
command("from-yaml", from_yaml::from_yaml), command("from-yaml", from_yaml::from_yaml),
command("get", get::get),
command("open", open::open), command("open", open::open),
command("pick", pick::pick), command("pick", pick::pick),
command("split-column", split_column::split_column), command("split-column", split_column::split_column),
command("split-row", split_row::split_row), command("split-row", split_row::split_row),
command("reject", reject::reject), command("reject", reject::reject),
command("select", select::select),
command("trim", trim::trim), command("trim", trim::trim),
command("to-array", to_array::to_array), command("to-array", to_array::to_array),
command("to-json", to_json::to_json), command("to-json", to_json::to_json),

View file

@ -7,12 +7,12 @@ crate mod first;
crate mod from_json; crate mod from_json;
crate mod from_toml; crate mod from_toml;
crate mod from_yaml; crate mod from_yaml;
crate mod get;
crate mod ls; crate mod ls;
crate mod open; crate mod open;
crate mod pick; crate mod pick;
crate mod ps; crate mod ps;
crate mod reject; crate mod reject;
crate mod select;
crate mod size; crate mod size;
crate mod skip; crate mod skip;
crate mod sort_by; crate mod sort_by;

View file

@ -19,7 +19,7 @@ fn get_member(path: &str, obj: &Value) -> Option<Value> {
Some(current.copy()) Some(current.copy())
} }
pub fn select(args: CommandArgs) -> Result<OutputStream, ShellError> { pub fn get(args: CommandArgs) -> Result<OutputStream, ShellError> {
if args.positional.is_empty() { if args.positional.is_empty() {
return Err(ShellError::string("select requires a field")); return Err(ShellError::string("select requires a field"));
} }

View file

@ -1,3 +1,3 @@
cd tests cd tests
open test.json | to-json | from-json | select glossary.GlossDiv.title | echo $it open test.json | to-json | from-json | get glossary.GlossDiv.title | echo $it
exit exit

View file

@ -1,3 +1,3 @@
cd tests cd tests
open test.json | select glossary.GlossDiv.GlossList.GlossEntry.GlossSee | echo $it open test.json | get glossary.GlossDiv.GlossList.GlossEntry.GlossSee | echo $it
exit exit

View file

@ -1,3 +1,3 @@
cd tests cd tests
open test.toml | select package.edition | echo $it open test.toml | get package.edition | echo $it
exit exit

View file

@ -1,3 +1,3 @@
cd tests cd tests
open test.toml --raw | split-row "\n" | skip 1 | first 4 | split-column "=" | sort-by Column1 | skip 1 | first 1 | select Column1 | trim | echo $it open test.toml --raw | split-row "\n" | skip 1 | first 4 | split-column "=" | sort-by Column1 | skip 1 | first 1 | get Column1 | trim | echo $it
exit exit

View file

@ -1,3 +1,3 @@
cd tests cd tests
open test.toml --raw | split-row "\n" | skip 1 | first 1 | split-column "=" | select Column1 | trim | echo $it open test.toml --raw | split-row "\n" | skip 1 | first 1 | split-column "=" | get Column1 | trim | echo $it
exit exit

View file

@ -1,3 +1,3 @@
cd tests cd tests
open test.toml | to-toml | from-toml | select package.name | echo $it open test.toml | to-toml | from-toml | get package.name | echo $it
exit exit