fix typo, update some examples and regenerate docs (#4718)

This commit is contained in:
Justin Ma 2022-03-04 20:10:09 +08:00 committed by GitHub
parent eeef9f27eb
commit 1157fcf372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
347 changed files with 436 additions and 374 deletions

View File

@ -48,7 +48,7 @@ impl Command for Rm {
)
.switch("recursive", "delete subdirectories recursively", Some('r'))
.switch("force", "suppress error when no file", Some('f'))
.switch("quiet", "supress output showing files deleted", Some('q'))
.switch("quiet", "suppress output showing files deleted", Some('q'))
// .switch("interactive", "ask user to confirm action", Some('i'))
.rest(
"rest",

View File

@ -81,7 +81,7 @@ impl Command for Each {
},
Example {
example: r#"[1 2 3] | each -n { |it| if $it.item == 2 { echo $"found 2 at ($it.index)!"} }"#,
description: "Iterate over each element, print the matching value and it's index",
description: "Iterate over each element, print the matching value and its index",
result: Some(Value::List {
vals: vec![Value::String {
val: "found 2 at 1!".to_string(),

View File

@ -39,7 +39,7 @@ impl Command for ParEach {
},
Example {
example: r#"[1 2 3] | par-each -n { |it| if $it.item == 2 { echo $"found 2 at ($it.index)!"} }"#,
description: "Iterate over each element, print the matching value and it's index",
description: "Iterate over each element, print the matching value and its index",
result: Some(Value::List {
vals: vec![Value::String {
val: "found 2 at 1!".to_string(),

View File

@ -32,7 +32,7 @@ impl Command for ParEachGroup {
fn examples(&self) -> Vec<Example> {
vec![Example {
example: "echo [1 2 3 4] | par-each group 2 { $it.0 + $it.1 }",
example: "echo [1 2 3 4] | par-each group 2 {|it| $it.0 + $it.1 }",
description: "Multiplies elements in list",
result: None,
}]

View File

@ -40,7 +40,7 @@ impl Command for SubCommand {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Evalulate math in the pipeline",
description: "Evaluate math in the pipeline",
example: "'10 / 4' | math eval",
result: Some(Value::Float {
val: 2.5,

View File

@ -283,7 +283,7 @@ Format: #
)),
},
Example {
description: "Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purble bold 'World')",
description: "Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purple bold 'World')",
example: r#"echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect"#,
result: Some(Value::test_string(
"\u{1b}[3;93;41mHello\u{1b}[0m \u{1b}[1;32mNu \u{1b}[1;35mWorld\u{1b}[0m",

View File

@ -41,11 +41,28 @@ impl Command for Ps {
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "List the system processes",
example: "ps",
result: None,
}]
vec![
Example {
description: "List the system processes",
example: "ps",
result: None,
},
Example {
description: "List the top 5 system processes with the highest memory usage",
example: "ps | sort-by mem | last 5",
result: None,
},
Example {
description: "List the top 3 system processes with the highest CPU usage",
example: "ps | sort-by cpu | last 3",
result: None,
},
Example {
description: "List the system processes with 'nu' in their names",
example: "ps | where name =~ 'nu'",
result: None,
},
]
}
}

View File

@ -36,7 +36,7 @@ fn sets_block_run_value_for_an_empty_column() {
[ Jason, Gedge, 10/11/2013, 1 ]
[ Yehuda, Katz, 10/11/2013, '' ]
]
| empty? likes -b { 1 }
| empty? likes -b {|_| 1 }
| get likes
| math sum
"#

View File

@ -33,7 +33,7 @@ fn error_when_invalid_character_set_given() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo 'username:password' | hash base64 --character_set 'this is invalid' --encode
echo 'username:password' | hash base64 --character-set 'this is invalid' --encode
"#
)
);
@ -50,7 +50,7 @@ fn base64_decode_characterset_binhex() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo "F@0NEPjJD97kE'&bEhFZEP3" | hash base64 --character_set binhex --decode
echo "F@0NEPjJD97kE'&bEhFZEP3" | hash base64 --character-set binhex --decode
"#
)
);

View File

@ -1,7 +1,7 @@
---
title: alias
layout: command
version: 0.59.0
version: 0.59.1
---
Alias a command (with optional flags) to a new name

View File

@ -1,7 +1,7 @@
---
title: all?
layout: command
version: 0.59.0
version: 0.59.1
---
Test if every element of the input matches a predicate.

View File

@ -1,7 +1,7 @@
---
title: ansi
layout: command
version: 0.59.0
version: 0.59.1
---
Output ANSI codes to change color.
@ -34,7 +34,7 @@ Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold)
> echo [(ansi rb) Hello " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect
```
Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purble bold 'World')
Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purple bold 'World')
```shell
> echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect
```

View File

@ -1,7 +1,7 @@
---
title: ansi gradient
layout: command
version: 0.59.0
version: 0.59.1
---
draw text with a provided start and end code making a gradient

View File

@ -1,7 +1,7 @@
---
title: ansi strip
layout: command
version: 0.59.0
version: 0.59.1
---
strip ansi escape sequences from string

View File

@ -1,7 +1,7 @@
---
title: any?
layout: command
version: 0.59.0
version: 0.59.1
---
Tests if any element of the input matches a predicate.

View File

@ -1,7 +1,7 @@
---
title: append
layout: command
version: 0.59.0
version: 0.59.1
---
Append a row to the table.

View File

@ -1,7 +1,7 @@
---
title: benchmark
layout: command
version: 0.59.0
version: 0.59.1
---
Time the running time of a block

View File

@ -1,7 +1,7 @@
---
title: build-string
layout: command
version: 0.59.0
version: 0.59.1
---
Create a string from the arguments.

View File

@ -1,7 +1,7 @@
---
title: cal
layout: command
version: 0.59.0
version: 0.59.1
---
Display a calendar.

View File

@ -1,7 +1,7 @@
---
title: cd
layout: command
version: 0.59.0
version: 0.59.1
---
Change directory.

View File

@ -1,7 +1,7 @@
---
title: char
layout: command
version: 0.59.0
version: 0.59.1
---
Output special characters (e.g., 'newline').

View File

@ -1,7 +1,7 @@
---
title: clear
layout: command
version: 0.59.0
version: 0.59.1
---
Clear the terminal.

View File

@ -1,7 +1,7 @@
---
title: collect
layout: command
version: 0.59.0
version: 0.59.1
---
Collect the stream and pass it to a block.

View File

@ -1,7 +1,7 @@
---
title: columns
layout: command
version: 0.59.0
version: 0.59.1
---
Show the columns in the input.

View File

@ -1,7 +1,7 @@
---
title: compact
layout: command
version: 0.59.0
version: 0.59.1
---
Creates a table with non-empty rows.

View File

@ -1,7 +1,7 @@
---
title: complete
layout: command
version: 0.59.0
version: 0.59.1
---
Complete the external piped in, collecting outputs and exit code

View File

@ -1,7 +1,7 @@
---
title: cp
layout: command
version: 0.59.0
version: 0.59.1
---
Copy files.

View File

@ -1,7 +1,7 @@
---
title: dataframe
layout: command
version: 0.59.0
version: 0.59.1
---
Deprecated command

View File

@ -1,7 +1,7 @@
---
title: date
layout: command
version: 0.59.0
version: 0.59.1
---
date

View File

@ -1,7 +1,7 @@
---
title: date format
layout: command
version: 0.59.0
version: 0.59.1
---
Format a given date using a format string.

View File

@ -1,7 +1,7 @@
---
title: date humanize
layout: command
version: 0.59.0
version: 0.59.1
---
Print a 'humanized' format for the date, relative to now.

View File

@ -1,7 +1,7 @@
---
title: date list-timezone
layout: command
version: 0.59.0
version: 0.59.1
---
List supported time zones.

View File

@ -1,7 +1,7 @@
---
title: date now
layout: command
version: 0.59.0
version: 0.59.1
---
Get the current date.

View File

@ -1,7 +1,7 @@
---
title: date to-table
layout: command
version: 0.59.0
version: 0.59.1
---
Print the date in a structured table.

View File

@ -1,7 +1,7 @@
---
title: date to-timezone
layout: command
version: 0.59.0
version: 0.59.1
---
Convert a date to a given time zone.

View File

@ -1,7 +1,7 @@
---
title: debug
layout: command
version: 0.59.0
version: 0.59.1
---
Debug print the value(s) piped in.

View File

@ -1,7 +1,7 @@
---
title: decode
layout: command
version: 0.59.0
version: 0.59.1
---
Decode bytes as a string.

View File

@ -1,7 +1,7 @@
---
title: def-env
layout: command
version: 0.59.0
version: 0.59.1
---
Define a custom command, which participates in the caller environment

View File

@ -1,7 +1,7 @@
---
title: def
layout: command
version: 0.59.0
version: 0.59.1
---
Define a custom command

View File

@ -1,7 +1,7 @@
---
title: default
layout: command
version: 0.59.0
version: 0.59.1
---
Sets a default row's column if missing.

View File

@ -1,7 +1,7 @@
---
title: describe
layout: command
version: 0.59.0
version: 0.59.1
---
Describe the value(s) piped in.

View File

@ -1,7 +1,7 @@
---
title: detect columns
layout: command
version: 0.59.0
version: 0.59.1
---
splits contents across multiple columns via the separator.

View File

@ -1,7 +1,7 @@
---
title: dfr
layout: command
version: 0.59.0
version: 0.59.1
---
Dataframe commands

View File

@ -1,7 +1,7 @@
---
title: dfr aggregate
layout: command
version: 0.59.0
version: 0.59.1
---
Performs an aggregation operation on a dataframe and groupby object

View File

@ -1,7 +1,7 @@
---
title: dfr all-false
layout: command
version: 0.59.0
version: 0.59.1
---
Returns true if all values are false

View File

@ -1,7 +1,7 @@
---
title: dfr all-true
layout: command
version: 0.59.0
version: 0.59.1
---
Returns true if all values are true

View File

@ -1,7 +1,7 @@
---
title: dfr append
layout: command
version: 0.59.0
version: 0.59.1
---
Appends a new dataframe

View File

@ -1,7 +1,7 @@
---
title: dfr arg-max
layout: command
version: 0.59.0
version: 0.59.1
---
Return index for max value in series

View File

@ -1,7 +1,7 @@
---
title: dfr arg-min
layout: command
version: 0.59.0
version: 0.59.1
---
Return index for min value in series

View File

@ -1,7 +1,7 @@
---
title: dfr arg-sort
layout: command
version: 0.59.0
version: 0.59.1
---
Returns indexes for a sorted series

View File

@ -1,7 +1,7 @@
---
title: dfr arg-true
layout: command
version: 0.59.0
version: 0.59.1
---
Returns indexes where values are true

View File

@ -1,7 +1,7 @@
---
title: dfr arg-unique
layout: command
version: 0.59.0
version: 0.59.1
---
Returns indexes for unique values

View File

@ -1,7 +1,7 @@
---
title: dfr column
layout: command
version: 0.59.0
version: 0.59.1
---
Returns the selected column

View File

@ -1,7 +1,7 @@
---
title: dfr concatenate
layout: command
version: 0.59.0
version: 0.59.1
---
Concatenates strings with other array

View File

@ -1,7 +1,7 @@
---
title: dfr contains
layout: command
version: 0.59.0
version: 0.59.1
---
Checks if a pattern is contained in a string

View File

@ -1,7 +1,7 @@
---
title: dfr count-null
layout: command
version: 0.59.0
version: 0.59.1
---
Counts null values

View File

@ -1,7 +1,7 @@
---
title: dfr count-unique
layout: command
version: 0.59.0
version: 0.59.1
---
Counts unique values

View File

@ -1,7 +1,7 @@
---
title: dfr cumulative
layout: command
version: 0.59.0
version: 0.59.1
---
Cumulative calculation for a series

View File

@ -1,7 +1,7 @@
---
title: dfr describe
layout: command
version: 0.59.0
version: 0.59.1
---
Describes dataframes numeric columns

View File

@ -1,7 +1,7 @@
---
title: dfr drop-duplicates
layout: command
version: 0.59.0
version: 0.59.1
---
Drops duplicate values in dataframe

View File

@ -1,7 +1,7 @@
---
title: dfr drop-nulls
layout: command
version: 0.59.0
version: 0.59.1
---
Drops null values in dataframe

View File

@ -1,7 +1,7 @@
---
title: dfr drop
layout: command
version: 0.59.0
version: 0.59.1
---
Creates a new dataframe by dropping the selected columns

View File

@ -1,7 +1,7 @@
---
title: dfr dtypes
layout: command
version: 0.59.0
version: 0.59.1
---
Show dataframe data types

View File

@ -1,7 +1,7 @@
---
title: dfr filter-with
layout: command
version: 0.59.0
version: 0.59.1
---
Filters dataframe using a mask as reference

View File

@ -1,7 +1,7 @@
---
title: dfr first
layout: command
version: 0.59.0
version: 0.59.1
---
Creates new dataframe with first rows

View File

@ -1,7 +1,7 @@
---
title: dfr get-day
layout: command
version: 0.59.0
version: 0.59.1
---
Gets day from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-hour
layout: command
version: 0.59.0
version: 0.59.1
---
Gets hour from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-minute
layout: command
version: 0.59.0
version: 0.59.1
---
Gets minute from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-month
layout: command
version: 0.59.0
version: 0.59.1
---
Gets month from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-nanosecond
layout: command
version: 0.59.0
version: 0.59.1
---
Gets nanosecond from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-ordinal
layout: command
version: 0.59.0
version: 0.59.1
---
Gets ordinal from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-second
layout: command
version: 0.59.0
version: 0.59.1
---
Gets second from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-week
layout: command
version: 0.59.0
version: 0.59.1
---
Gets week from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-weekday
layout: command
version: 0.59.0
version: 0.59.1
---
Gets weekday from date

View File

@ -1,7 +1,7 @@
---
title: dfr get-year
layout: command
version: 0.59.0
version: 0.59.1
---
Gets year from date

View File

@ -1,7 +1,7 @@
---
title: dfr get
layout: command
version: 0.59.0
version: 0.59.1
---
Creates dataframe with the selected columns

View File

@ -1,7 +1,7 @@
---
title: dfr group-by
layout: command
version: 0.59.0
version: 0.59.1
---
Creates a groupby object that can be used for other aggregations

View File

@ -1,7 +1,7 @@
---
title: dfr is-duplicated
layout: command
version: 0.59.0
version: 0.59.1
---
Creates mask indicating duplicated values

View File

@ -1,7 +1,7 @@
---
title: dfr is-in
layout: command
version: 0.59.0
version: 0.59.1
---
Checks if elements from a series are contained in right series

View File

@ -1,7 +1,7 @@
---
title: dfr is-not-null
layout: command
version: 0.59.0
version: 0.59.1
---
Creates mask where value is not null

View File

@ -1,7 +1,7 @@
---
title: dfr is-null
layout: command
version: 0.59.0
version: 0.59.1
---
Creates mask where value is null

View File

@ -1,7 +1,7 @@
---
title: dfr is-unique
layout: command
version: 0.59.0
version: 0.59.1
---
Creates mask indicating unique values

View File

@ -1,7 +1,7 @@
---
title: dfr join
layout: command
version: 0.59.0
version: 0.59.1
---
Joins a dataframe using columns as reference

View File

@ -1,7 +1,7 @@
---
title: dfr last
layout: command
version: 0.59.0
version: 0.59.1
---
Creates new dataframe with tail rows

19
docs/commands/dfr_list.md Normal file
View File

@ -0,0 +1,19 @@
---
title: dfr list
layout: command
version: 0.59.1
---
Lists stored dataframes
## Signature
```> dfr list ```
## Examples
Creates a new dataframe and shows it in the dataframe list
```shell
> let test = ([[a b];[1 2] [3 4]] | dfr to-df);
dfr list
```

View File

@ -1,7 +1,7 @@
---
title: dfr melt
layout: command
version: 0.59.0
version: 0.59.1
---
Unpivot a DataFrame from wide to long format

View File

@ -1,7 +1,7 @@
---
title: dfr not
layout: command
version: 0.59.0
version: 0.59.1
---
Inverts boolean mask

View File

@ -1,7 +1,7 @@
---
title: dfr open
layout: command
version: 0.59.0
version: 0.59.1
---
Opens csv, json or parquet file to create dataframe

View File

@ -1,7 +1,7 @@
---
title: dfr pivot
layout: command
version: 0.59.0
version: 0.59.1
---
Performs a pivot operation on a groupby object

View File

@ -1,7 +1,7 @@
---
title: dfr rename-col
layout: command
version: 0.59.0
version: 0.59.1
---
rename a dataframe column

View File

@ -1,7 +1,7 @@
---
title: dfr rename
layout: command
version: 0.59.0
version: 0.59.1
---
Renames a series

View File

@ -1,7 +1,7 @@
---
title: dfr replace-all
layout: command
version: 0.59.0
version: 0.59.1
---
Replace all (sub)strings by a regex pattern

View File

@ -1,7 +1,7 @@
---
title: dfr replace
layout: command
version: 0.59.0
version: 0.59.1
---
Replace the leftmost (sub)string by a regex pattern

View File

@ -1,7 +1,7 @@
---
title: dfr rolling
layout: command
version: 0.59.0
version: 0.59.1
---
Rolling calculation for a series

View File

@ -1,7 +1,7 @@
---
title: dfr sample
layout: command
version: 0.59.0
version: 0.59.1
---
Create sample dataframe

View File

@ -1,7 +1,7 @@
---
title: dfr set-with-idx
layout: command
version: 0.59.0
version: 0.59.1
---
Sets value in the given index

View File

@ -1,7 +1,7 @@
---
title: dfr set
layout: command
version: 0.59.0
version: 0.59.1
---
Sets value where given mask is true

View File

@ -1,7 +1,7 @@
---
title: dfr shape
layout: command
version: 0.59.0
version: 0.59.1
---
Shows column and row size for a dataframe

View File

@ -1,7 +1,7 @@
---
title: dfr shift
layout: command
version: 0.59.0
version: 0.59.1
---
Shifts the values by a given period

View File

@ -1,7 +1,7 @@
---
title: dfr slice
layout: command
version: 0.59.0
version: 0.59.1
---
Creates new dataframe from a slice of rows

Some files were not shown because too many files have changed in this diff Show More