mirror of
https://github.com/nushell/nushell
synced 2024-12-26 04:53:09 +00:00
Merge pull request #82 from jonathandturner/rename_select
Rename select
This commit is contained in:
commit
02e6ee6991
10 changed files with 12 additions and 12 deletions
|
@ -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 |
|
||||
| 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 |
|
||||
| where condition | Filter table to match the condition |
|
||||
| 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]
|
||||
----------------------------------------------------
|
||||
|
||||
~\Code\nushell> open Cargo.toml | select package
|
||||
~\Code\nushell> open Cargo.toml | get package
|
||||
--------------------------------------------------------------------------
|
||||
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.
|
||||
|
||||
```text
|
||||
~\Code\nushell> open Cargo.toml | select package.version | echo $it
|
||||
~\Code\nushell> open Cargo.toml | get package.version | echo $it
|
||||
0.1.1
|
||||
```
|
||||
|
||||
|
|
|
@ -54,12 +54,12 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
|
|||
command("from-json", from_json::from_json),
|
||||
command("from-toml", from_toml::from_toml),
|
||||
command("from-yaml", from_yaml::from_yaml),
|
||||
command("get", get::get),
|
||||
command("open", open::open),
|
||||
command("pick", pick::pick),
|
||||
command("split-column", split_column::split_column),
|
||||
command("split-row", split_row::split_row),
|
||||
command("reject", reject::reject),
|
||||
command("select", select::select),
|
||||
command("trim", trim::trim),
|
||||
command("to-array", to_array::to_array),
|
||||
command("to-json", to_json::to_json),
|
||||
|
|
|
@ -7,12 +7,12 @@ crate mod first;
|
|||
crate mod from_json;
|
||||
crate mod from_toml;
|
||||
crate mod from_yaml;
|
||||
crate mod get;
|
||||
crate mod ls;
|
||||
crate mod open;
|
||||
crate mod pick;
|
||||
crate mod ps;
|
||||
crate mod reject;
|
||||
crate mod select;
|
||||
crate mod size;
|
||||
crate mod skip;
|
||||
crate mod sort_by;
|
||||
|
|
|
@ -19,7 +19,7 @@ fn get_member(path: &str, obj: &Value) -> Option<Value> {
|
|||
Some(current.copy())
|
||||
}
|
||||
|
||||
pub fn select(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
pub fn get(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
if args.positional.is_empty() {
|
||||
return Err(ShellError::string("select requires a field"));
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
cd tests
|
||||
open test.toml | select package.edition | echo $it
|
||||
open test.toml | get package.edition | echo $it
|
||||
exit
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue