mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
Strip trailing whitespace in files (#4575)
* Strip trailing whitespace in rs files * Strip trailing whitespace in toml files * Strip trailing whitespace in md files * Strip trailing whitespace in nu files
This commit is contained in:
parent
968427c4e9
commit
4f367a59de
33 changed files with 83 additions and 83 deletions
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
|
@ -1,7 +1,7 @@
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
(description of your pull request here)
|
(description of your pull request here)
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
Make sure you've run and fixed any issues with these commands:
|
Make sure you've run and fixed any issues with these commands:
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl Command for ErrorMake {
|
||||||
description: "Create a custom error for a custom command",
|
description: "Create a custom error for a custom command",
|
||||||
example: r#"def foo [x] {
|
example: r#"def foo [x] {
|
||||||
let span = (metadata $x).span;
|
let span = (metadata $x).span;
|
||||||
error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }
|
error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }
|
||||||
}"#,
|
}"#,
|
||||||
result: None,
|
result: None,
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -195,7 +195,7 @@ can use the `get` command.
|
||||||
ls | get name
|
ls | get name
|
||||||
```
|
```
|
||||||
This allows us to get to the list of strings that are the filenames rather
|
This allows us to get to the list of strings that are the filenames rather
|
||||||
than having a full table. In some cases, this can make the names easier to
|
than having a full table. In some cases, this can make the names easier to
|
||||||
work with.
|
work with.
|
||||||
|
|
||||||
You can continue to learn more about working with cells of the table by
|
You can continue to learn more about working with cells of the table by
|
||||||
|
@ -255,7 +255,7 @@ expressions, but they're wrapped in parentheses `()`.
|
||||||
```
|
```
|
||||||
10 * (3 + 4)
|
10 * (3 + 4)
|
||||||
```
|
```
|
||||||
Here we use parentheses to create a higher math precedence in the math
|
Here we use parentheses to create a higher math precedence in the math
|
||||||
expression.
|
expression.
|
||||||
```
|
```
|
||||||
echo (2 + 3)
|
echo (2 + 3)
|
||||||
|
@ -375,7 +375,7 @@ the shorthand path to retrieve only the cell data inside the "cwd" column.
|
||||||
```
|
```
|
||||||
(ls).name.4
|
(ls).name.4
|
||||||
```
|
```
|
||||||
This will retrieve the cell data in the "name" column on the 5th row (note:
|
This will retrieve the cell data in the "name" column on the 5th row (note:
|
||||||
row numbers are zero-based).
|
row numbers are zero-based).
|
||||||
|
|
||||||
Rows and columns don't need to come in any specific order. You can get the
|
Rows and columns don't need to come in any specific order. You can get the
|
||||||
|
@ -388,8 +388,8 @@ same value using:
|
||||||
|
|
||||||
fn engineq_tutor() -> &'static str {
|
fn engineq_tutor() -> &'static str {
|
||||||
r#"
|
r#"
|
||||||
Engine-q is the upcoming engine for Nushell. Build for speed and correctness,
|
Engine-q is the upcoming engine for Nushell. Build for speed and correctness,
|
||||||
it also comes with a set of changes from Nushell versions prior to 0.60. To
|
it also comes with a set of changes from Nushell versions prior to 0.60. To
|
||||||
get ready for engine-q look for some of these changes that might impact your
|
get ready for engine-q look for some of these changes that might impact your
|
||||||
current scripts:
|
current scripts:
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ current scripts:
|
||||||
* Environment variables can now contain more than just strings. Structured
|
* Environment variables can now contain more than just strings. Structured
|
||||||
values are converted to strings for external commands using converters.
|
values are converted to strings for external commands using converters.
|
||||||
* `if` will now use an `else` keyword before the else block.
|
* `if` will now use an `else` keyword before the else block.
|
||||||
* We're moving from "config.toml" to "config.nu". This means startup will
|
* We're moving from "config.toml" to "config.nu". This means startup will
|
||||||
now be a script file.
|
now be a script file.
|
||||||
* `config` and its subcommands are being replaced by a record that you can
|
* `config` and its subcommands are being replaced by a record that you can
|
||||||
update in the shell which contains all the settings under the variable
|
update in the shell which contains all the settings under the variable
|
||||||
|
|
|
@ -5,10 +5,10 @@ pub fn unsupported_input_error(span: Span) -> Value {
|
||||||
Value::Error {
|
Value::Error {
|
||||||
error: ShellError::UnsupportedInput(
|
error: ShellError::UnsupportedInput(
|
||||||
String::from(
|
String::from(
|
||||||
"Only dates with timezones are supported. The following formats are allowed \n
|
"Only dates with timezones are supported. The following formats are allowed \n
|
||||||
* %Y-%m-%d %H:%M:%S %z -- 2020-04-12 22:10:57 +02:00 \n
|
* %Y-%m-%d %H:%M:%S %z -- 2020-04-12 22:10:57 +02:00 \n
|
||||||
* %Y-%m-%d %H:%M:%S%.6f %z -- 2020-04-12 22:10:57.213231 +02:00 \n
|
* %Y-%m-%d %H:%M:%S%.6f %z -- 2020-04-12 22:10:57.213231 +02:00 \n
|
||||||
* rfc3339 -- 2020-04-12T22:10:57+02:00 \n
|
* rfc3339 -- 2020-04-12T22:10:57+02:00 \n
|
||||||
* rfc2822 -- Tue, 1 Jul 2003 10:52:37 +0200",
|
* rfc2822 -- Tue, 1 Jul 2003 10:52:37 +0200",
|
||||||
),
|
),
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl Command for Empty {
|
||||||
Value::List {
|
Value::List {
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::Record{
|
Value::Record{
|
||||||
cols: vec!["2020/04/16".to_string(), "2020/07/10".to_string(), "2020/11/16".to_string()],
|
cols: vec!["2020/04/16".to_string(), "2020/07/10".to_string(), "2020/11/16".to_string()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::List{vals: vec![
|
Value::List{vals: vec![
|
||||||
Value::Int{val: 33, span: Span::test_data()},
|
Value::Int{val: 33, span: Span::test_data()},
|
||||||
|
|
|
@ -77,22 +77,22 @@ impl Command for Flatten {
|
||||||
result: Some(Value::List{
|
result: Some(Value::List{
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::Record{
|
Value::Record{
|
||||||
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
||||||
vals: vec![Value::test_string("b"), Value::test_int(1), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
vals: vec![Value::test_string("b"), Value::test_int(1), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
||||||
span: Span::test_data()
|
span: Span::test_data()
|
||||||
},
|
},
|
||||||
Value::Record{
|
Value::Record{
|
||||||
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
||||||
vals: vec![Value::test_string("b"), Value::test_int(2), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
vals: vec![Value::test_string("b"), Value::test_int(2), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
||||||
span: Span::test_data()
|
span: Span::test_data()
|
||||||
},
|
},
|
||||||
Value::Record{
|
Value::Record{
|
||||||
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
||||||
vals: vec![Value::test_string("b"), Value::test_int(3), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
vals: vec![Value::test_string("b"), Value::test_int(3), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
||||||
span: Span::test_data()
|
span: Span::test_data()
|
||||||
},
|
},
|
||||||
Value::Record{
|
Value::Record{
|
||||||
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
cols: vec!["a".to_string(), "d".to_string(), "e".to_string()],
|
||||||
vals: vec![Value::test_string("b"), Value::test_int(4), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
vals: vec![Value::test_string("b"), Value::test_int(4), Value::List{vals: vec![Value::test_int(4), Value::test_int(3)], span: Span::test_data()} ],
|
||||||
span: Span::test_data()
|
span: Span::test_data()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ fn checks_all_rows_are_true() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo [ "Andrés", "Andrés", "Andrés" ]
|
echo [ "Andrés", "Andrés", "Andrés" ]
|
||||||
| all? $it == "Andrés"
|
| all? $it == "Andrés"
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
|
@ -5,7 +5,7 @@ fn checks_any_row_is_true() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo [ "Ecuador", "USA", "New Zealand" ]
|
echo [ "Ecuador", "USA", "New Zealand" ]
|
||||||
| any? $it == "New Zealand"
|
| any? $it == "New Zealand"
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
|
@ -5,7 +5,7 @@ fn adds_a_row_to_the_end() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo [ "Andrés N. Robalino", "Jonathan Turner", "Yehuda Katz" ]
|
echo [ "Andrés N. Robalino", "Jonathan Turner", "Yehuda Katz" ]
|
||||||
| append "pollo loco"
|
| append "pollo loco"
|
||||||
| get 3
|
| get 3
|
||||||
"#
|
"#
|
||||||
|
|
|
@ -28,7 +28,7 @@ fn flatten_nested_tables_that_have_many_columns() {
|
||||||
cwd: ".", pipeline(
|
cwd: ".", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo [[origin, people]; [Ecuador, (echo [[name, meal]; ['Andres', 'arepa']])]]
|
echo [[origin, people]; [Ecuador, (echo [[name, meal]; ['Andres', 'arepa']])]]
|
||||||
[[origin, people]; [USA, (echo [[name, meal]; ['Katz', 'nurepa']])]]
|
[[origin, people]; [USA, (echo [[name, meal]; ['Katz', 'nurepa']])]]
|
||||||
| flatten
|
| flatten
|
||||||
| get meal
|
| get meal
|
||||||
| str collect ','
|
| str collect ','
|
||||||
|
|
|
@ -33,10 +33,10 @@ fn condition_is_met() {
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
open --raw caballeros.txt
|
open --raw caballeros.txt
|
||||||
| lines
|
| lines
|
||||||
| skip 2
|
| skip 2
|
||||||
| str trim
|
| str trim
|
||||||
| str collect (char nl)
|
| str collect (char nl)
|
||||||
| from csv
|
| from csv
|
||||||
| skip while "Chicken Collection" != "Blue Chickens"
|
| skip while "Chicken Collection" != "Blue Chickens"
|
||||||
| keep until "Chicken Collection" == "Red Chickens"
|
| keep until "Chicken Collection" == "Red Chickens"
|
||||||
|
|
|
@ -33,10 +33,10 @@ fn condition_is_met() {
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
open --raw caballeros.txt
|
open --raw caballeros.txt
|
||||||
| lines
|
| lines
|
||||||
| skip 2
|
| skip 2
|
||||||
| str trim
|
| str trim
|
||||||
| str collect (char nl)
|
| str collect (char nl)
|
||||||
| from csv
|
| from csv
|
||||||
| skip 1
|
| skip 1
|
||||||
| keep while "Chicken Collection" != "Blue Chickens"
|
| keep while "Chicken Collection" != "Blue Chickens"
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn returns_basename_of_empty_input() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo ""
|
echo ""
|
||||||
| path basename
|
| path basename
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -20,7 +20,7 @@ fn replaces_basename_of_empty_input() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo ""
|
echo ""
|
||||||
| path basename -r newname.txt
|
| path basename -r newname.txt
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -33,8 +33,8 @@ fn returns_basename_of_path_ending_with_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/file.txt/."
|
echo "some/file.txt/."
|
||||||
| path basename
|
| path basename
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ fn replaces_basename_of_path_ending_with_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/file.txt/."
|
echo "some/file.txt/."
|
||||||
| path basename -r viking.txt
|
| path basename -r viking.txt
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -60,8 +60,8 @@ fn returns_basename_of_path_ending_with_double_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/file.txt/.."
|
echo "some/file.txt/.."
|
||||||
| path basename
|
| path basename
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ fn replaces_basename_of_path_ending_with_double_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/file.txt/.."
|
echo "some/file.txt/.."
|
||||||
| path basename -r eggs
|
| path basename -r eggs
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn returns_dirname_of_empty_input() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo ""
|
echo ""
|
||||||
| path dirname
|
| path dirname
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -20,7 +20,7 @@ fn replaces_dirname_of_empty_input() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo ""
|
echo ""
|
||||||
| path dirname -r newdir
|
| path dirname -r newdir
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -33,8 +33,8 @@ fn returns_dirname_of_path_ending_with_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/dir/."
|
echo "some/dir/."
|
||||||
| path dirname
|
| path dirname
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ fn replaces_dirname_of_path_ending_with_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/dir/."
|
echo "some/dir/."
|
||||||
| path dirname -r eggs
|
| path dirname -r eggs
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -60,8 +60,8 @@ fn returns_dirname_of_path_ending_with_double_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/dir/.."
|
echo "some/dir/.."
|
||||||
| path dirname
|
| path dirname
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ fn replaces_dirname_of_path_with_double_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "some/dir/.."
|
echo "some/dir/.."
|
||||||
| path dirname -r eggs
|
| path dirname -r eggs
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn expands_path_with_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "menu/./spam.txt"
|
echo "menu/./spam.txt"
|
||||||
| path expand
|
| path expand
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -34,7 +34,7 @@ fn expands_path_with_double_dot() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "menu/../menu/spam.txt"
|
echo "menu/../menu/spam.txt"
|
||||||
| path expand
|
| path expand
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn returns_type_of_missing_file() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests", pipeline(
|
cwd: "tests", pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "spam.txt"
|
echo "spam.txt"
|
||||||
| path type
|
| path type
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -27,7 +27,7 @@ fn returns_type_of_existing_file() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "menu"
|
echo "menu"
|
||||||
| path type
|
| path type
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
@ -48,7 +48,7 @@ fn returns_type_of_existing_directory() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
echo "menu/spam.txt"
|
echo "menu/spam.txt"
|
||||||
| path type
|
| path type
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
|
@ -32,11 +32,11 @@ fn condition_is_met() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
open --raw ./caballeros.txt
|
open --raw ./caballeros.txt
|
||||||
| lines
|
| lines
|
||||||
| skip 2
|
| skip 2
|
||||||
| str trim
|
| str trim
|
||||||
| str collect (char nl)
|
| str collect (char nl)
|
||||||
| from csv
|
| from csv
|
||||||
| skip until "Chicken Collection" == "Red Chickens"
|
| skip until "Chicken Collection" == "Red Chickens"
|
||||||
| skip 1
|
| skip 1
|
||||||
|
|
|
@ -33,10 +33,10 @@ fn condition_is_met() {
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
r#"
|
r#"
|
||||||
open --raw caballeros.txt
|
open --raw caballeros.txt
|
||||||
| lines
|
| lines
|
||||||
| skip 2
|
| skip 2
|
||||||
| str trim
|
| str trim
|
||||||
| str collect (char nl)
|
| str collect (char nl)
|
||||||
| from csv
|
| from csv
|
||||||
| skip while "Chicken Collection" != "Red Chickens"
|
| skip while "Chicken Collection" != "Red Chickens"
|
||||||
| skip 1
|
| skip 1
|
||||||
|
|
|
@ -41,15 +41,15 @@ fn zips_two_tables() {
|
||||||
&format!(
|
&format!(
|
||||||
r#"
|
r#"
|
||||||
source {} ;
|
source {} ;
|
||||||
|
|
||||||
let contributors = ([
|
let contributors = ([
|
||||||
[name, commits];
|
[name, commits];
|
||||||
[andres, 10]
|
[andres, 10]
|
||||||
[ jt, 20]
|
[ jt, 20]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let actual = ($contributors | add-commits 10);
|
let actual = ($contributors | add-commits 10);
|
||||||
|
|
||||||
expect $actual --to-eq [[name, commits]; [andres, 20] [jt, 30]]
|
expect $actual --to-eq [[name, commits]; [andres, 20] [jt, 30]]
|
||||||
"#,
|
"#,
|
||||||
dirs.test().join("zip_test.nu").display()
|
dirs.test().join("zip_test.nu").display()
|
||||||
|
|
|
@ -4,7 +4,7 @@ description = "Fork of serde-hjson"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-json"
|
name = "nu-json"
|
||||||
version = "0.59.0"
|
version = "0.59.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ description = "Path handling library for Nushell"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-path"
|
name = "nu-path"
|
||||||
version = "0.59.0"
|
version = "0.59.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dirs-next = "2.0.0"
|
dirs-next = "2.0.0"
|
||||||
|
|
|
@ -4,7 +4,7 @@ description = "Support for writing Nushell tests"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
name = "nu-test-support"
|
name = "nu-test-support"
|
||||||
version = "0.59.0"
|
version = "0.59.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
|
@ -206,8 +206,8 @@ The `full "#hex"` format is a take on the `"#hex"` format but allows one to spec
|
||||||
|
|
||||||
Example: `{ fg: "#ff0000" bg: "#0000ff" attr: b }`
|
Example: `{ fg: "#ff0000" bg: "#0000ff" attr: b }`
|
||||||
|
|
||||||
* foreground of red in "#hex" format
|
* foreground of red in "#hex" format
|
||||||
* background of blue in "#hex" format
|
* background of blue in "#hex" format
|
||||||
* attribute of bold abbreviated
|
* attribute of bold abbreviated
|
||||||
|
|
||||||
## `Primitive values`
|
## `Primitive values`
|
||||||
|
|
|
@ -12,7 +12,7 @@ Performs an aggregation operation on a dataframe and groupby object
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
- `operation_name`:
|
- `operation_name`:
|
||||||
Dataframes: mean, sum, min, max, quantile, median, var, std
|
Dataframes: mean, sum, min, max, quantile, median, var, std
|
||||||
GroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count
|
GroupBy: mean, sum, min, max, first, last, nunique, quantile, median, var, std, count
|
||||||
- `--quantile {number}`: quantile value for quantile operation
|
- `--quantile {number}`: quantile value for quantile operation
|
||||||
|
|
|
@ -20,7 +20,7 @@ Create a custom error for a custom command
|
||||||
```shell
|
```shell
|
||||||
> def foo [x] {
|
> def foo [x] {
|
||||||
let span = (metadata $x).span;
|
let span = (metadata $x).span;
|
||||||
error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }
|
error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ Fetch the contents from a URL (HTTP GET operation).
|
||||||
- `--user {any}`: the username when authenticating
|
- `--user {any}`: the username when authenticating
|
||||||
- `--password {any}`: the password when authenticating
|
- `--password {any}`: the password when authenticating
|
||||||
- `--timeout {int}`: timeout period in seconds
|
- `--timeout {int}`: timeout period in seconds
|
||||||
- `--headers {any}`: custom headers you want to add
|
- `--headers {any}`: custom headers you want to add
|
||||||
- `--raw`: fetch contents as text rather than a table
|
- `--raw`: fetch contents as text rather than a table
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
|
@ -18,7 +18,7 @@ Flatten the table.
|
||||||
|
|
||||||
flatten a table
|
flatten a table
|
||||||
```shell
|
```shell
|
||||||
> [[N, u, s, h, e, l, l]] | flatten
|
> [[N, u, s, h, e, l, l]] | flatten
|
||||||
```
|
```
|
||||||
|
|
||||||
flatten a table, get the first item
|
flatten a table, get the first item
|
||||||
|
|
|
@ -18,7 +18,7 @@ Post a body to a URL (HTTP POST operation).
|
||||||
- `--password {any}`: the password when authenticating
|
- `--password {any}`: the password when authenticating
|
||||||
- `--content-type {any}`: the MIME type of content to post
|
- `--content-type {any}`: the MIME type of content to post
|
||||||
- `--content-length {any}`: the length of the content being posted
|
- `--content-length {any}`: the length of the content being posted
|
||||||
- `--headers {any}`: custom headers you want to add
|
- `--headers {any}`: custom headers you want to add
|
||||||
- `--raw`: return values as a string instead of a table
|
- `--raw`: return values as a string instead of a table
|
||||||
- `--insecure`: allow insecure server connections when using SSL
|
- `--insecure`: allow insecure server connections when using SSL
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Create a new table splitted.
|
||||||
|
|
||||||
split items by column named "lang"
|
split items by column named "lang"
|
||||||
```shell
|
```shell
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
'2019': [
|
'2019': [
|
||||||
{ name: 'andres', lang: 'rb', year: '2019' },
|
{ name: 'andres', lang: 'rb', year: '2019' },
|
||||||
|
@ -28,6 +28,6 @@ split items by column named "lang"
|
||||||
{ name: 'storm', lang: 'rs', 'year': '2021' }
|
{ name: 'storm', lang: 'rs', 'year': '2021' }
|
||||||
]
|
]
|
||||||
} | split-by lang
|
} | split-by lang
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ layout: command
|
||||||
version: 0.59.0
|
version: 0.59.0
|
||||||
---
|
---
|
||||||
|
|
||||||
Convert table into .csv text
|
Convert table into .csv text
|
||||||
|
|
||||||
## Signature
|
## Signature
|
||||||
|
|
||||||
|
@ -24,6 +24,6 @@ Outputs an CSV string representing the contents of this table
|
||||||
|
|
||||||
Outputs an CSV string representing the contents of this table
|
Outputs an CSV string representing the contents of this table
|
||||||
```shell
|
```shell
|
||||||
> [[foo bar]; [1 2]] | to csv -s ';'
|
> [[foo bar]; [1 2]] | to csv -s ';'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ error: aborting due to previous error
|
||||||
|
|
||||||
That's not certainly what we expected.
|
That's not certainly what we expected.
|
||||||
|
|
||||||
It happens that Nu needs to know more about the command, including it's name and signature. We didn't do any of that and the compiler is telling us so. We seem to be missing implementing the `WholeStreamCommand` trait. This is the trait that, when implemented, allows us to state it's name, signature, and the like.
|
It happens that Nu needs to know more about the command, including it's name and signature. We didn't do any of that and the compiler is telling us so. We seem to be missing implementing the `WholeStreamCommand` trait. This is the trait that, when implemented, allows us to state it's name, signature, and the like.
|
||||||
|
|
||||||
## WholeStreamCommand
|
## WholeStreamCommand
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ version: ($vers)
|
||||||
($command.usage)
|
($command.usage)
|
||||||
|
|
||||||
"
|
"
|
||||||
let sig = ($command.signature | each { |param|
|
let sig = ($command.signature | each { |param|
|
||||||
if $param.parameter_type == "positional" {
|
if $param.parameter_type == "positional" {
|
||||||
$"('(')($param.parameter_name)(')')"
|
$"('(')($param.parameter_name)(')')"
|
||||||
} else if $param.parameter_type == "switch" {
|
} else if $param.parameter_type == "switch" {
|
||||||
|
@ -56,7 +56,7 @@ $"($example.description)
|
||||||
|
|
||||||
$example_top + $examples
|
$example_top + $examples
|
||||||
} else { "" }
|
} else { "" }
|
||||||
|
|
||||||
let doc = ($top + $signature + $parameters + $examples)
|
let doc = ($top + $signature + $parameters + $examples)
|
||||||
|
|
||||||
let safe_name = ($command.command | str find-replace '\?' '' | str find-replace ' ' '_')
|
let safe_name = ($command.command | str find-replace '\?' '' | str find-replace ' ' '_')
|
||||||
|
|
|
@ -232,8 +232,8 @@ def 'call-me' [] {
|
||||||
echo $CONST_A
|
echo $CONST_A
|
||||||
}
|
}
|
||||||
|
|
||||||
[(say-hi) (call-me)] | str collect
|
[(say-hi) (call-me)] | str collect
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
"HelloHello",
|
"HelloHello",
|
||||||
)
|
)
|
||||||
|
@ -253,8 +253,8 @@ def 'say-hi' [] {
|
||||||
echo (call-me)
|
echo (call-me)
|
||||||
}
|
}
|
||||||
|
|
||||||
[(say-hi) (call-me)] | str collect
|
[(say-hi) (call-me)] | str collect
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
"HelloHello",
|
"HelloHello",
|
||||||
)
|
)
|
||||||
|
@ -274,8 +274,8 @@ def 'call-me' [] {
|
||||||
echo $CONST_A
|
echo $CONST_A
|
||||||
}
|
}
|
||||||
|
|
||||||
[(call-me) (say-hi)] | str collect
|
[(call-me) (say-hi)] | str collect
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
"HelloHello",
|
"HelloHello",
|
||||||
)
|
)
|
||||||
|
@ -295,8 +295,8 @@ def 'say-hi' [] {
|
||||||
echo (call-me)
|
echo (call-me)
|
||||||
}
|
}
|
||||||
|
|
||||||
[(call-me) (say-hi)] | str collect
|
[(call-me) (say-hi)] | str collect
|
||||||
|
|
||||||
"#,
|
"#,
|
||||||
"HelloHello",
|
"HelloHello",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue