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:
Joseph T. Lyons
2022-02-21 08:38:15 -05:00
committed by GitHub
parent 968427c4e9
commit 4f367a59de
33 changed files with 83 additions and 83 deletions

View File

@ -69,7 +69,7 @@ impl Command for ErrorMake {
description: "Create a custom error for a custom command",
example: r#"def foo [x] {
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,
}]

View File

@ -195,7 +195,7 @@ can use the `get` command.
ls | get name
```
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.
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)
```
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.
```
echo (2 + 3)
@ -375,7 +375,7 @@ the shorthand path to retrieve only the cell data inside the "cwd" column.
```
(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).
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 {
r#"
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
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
get ready for engine-q look for some of these changes that might impact your
current scripts:
@ -398,7 +398,7 @@ current scripts:
* Environment variables can now contain more than just strings. Structured
values are converted to strings for external commands using converters.
* `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.
* `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

View File

@ -5,10 +5,10 @@ pub fn unsupported_input_error(span: Span) -> Value {
Value::Error {
error: ShellError::UnsupportedInput(
String::from(
"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%.6f %z -- 2020-04-12 22:10:57.213231 +02:00 \n
* rfc3339 -- 2020-04-12T22:10:57+02:00 \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%.6f %z -- 2020-04-12 22:10:57.213231 +02:00 \n
* rfc3339 -- 2020-04-12T22:10:57+02:00 \n
* rfc2822 -- Tue, 1 Jul 2003 10:52:37 +0200",
),
span,

View File

@ -77,7 +77,7 @@ impl Command for Empty {
Value::List {
vals: vec![
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![
Value::List{vals: vec![
Value::Int{val: 33, span: Span::test_data()},

View File

@ -77,22 +77,22 @@ impl Command for Flatten {
result: Some(Value::List{
vals: vec![
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()} ],
span: Span::test_data()
},
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()} ],
span: Span::test_data()
},
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()} ],
span: Span::test_data()
},
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()} ],
span: Span::test_data()
}

View File

@ -5,7 +5,7 @@ fn checks_all_rows_are_true() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo [ "Andrés", "Andrés", "Andrés" ]
echo [ "Andrés", "Andrés", "Andrés" ]
| all? $it == "Andrés"
"#
));

View File

@ -5,7 +5,7 @@ fn checks_any_row_is_true() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo [ "Ecuador", "USA", "New Zealand" ]
echo [ "Ecuador", "USA", "New Zealand" ]
| any? $it == "New Zealand"
"#
));

View File

@ -5,7 +5,7 @@ fn adds_a_row_to_the_end() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo [ "Andrés N. Robalino", "Jonathan Turner", "Yehuda Katz" ]
echo [ "Andrés N. Robalino", "Jonathan Turner", "Yehuda Katz" ]
| append "pollo loco"
| get 3
"#

View File

@ -28,7 +28,7 @@ fn flatten_nested_tables_that_have_many_columns() {
cwd: ".", pipeline(
r#"
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
| get meal
| str collect ','

View File

@ -33,10 +33,10 @@ fn condition_is_met() {
cwd: dirs.test(), pipeline(
r#"
open --raw caballeros.txt
| lines
| skip 2
| lines
| skip 2
| str trim
| str collect (char nl)
| str collect (char nl)
| from csv
| skip while "Chicken Collection" != "Blue Chickens"
| keep until "Chicken Collection" == "Red Chickens"

View File

@ -33,10 +33,10 @@ fn condition_is_met() {
cwd: dirs.test(), pipeline(
r#"
open --raw caballeros.txt
| lines
| skip 2
| lines
| skip 2
| str trim
| str collect (char nl)
| str collect (char nl)
| from csv
| skip 1
| keep while "Chicken Collection" != "Blue Chickens"

View File

@ -7,7 +7,7 @@ fn returns_basename_of_empty_input() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo ""
echo ""
| path basename
"#
));
@ -20,7 +20,7 @@ fn replaces_basename_of_empty_input() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo ""
echo ""
| path basename -r newname.txt
"#
));
@ -33,8 +33,8 @@ fn returns_basename_of_path_ending_with_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/file.txt/."
| path basename
echo "some/file.txt/."
| path basename
"#
));
@ -46,7 +46,7 @@ fn replaces_basename_of_path_ending_with_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/file.txt/."
echo "some/file.txt/."
| path basename -r viking.txt
"#
));
@ -60,8 +60,8 @@ fn returns_basename_of_path_ending_with_double_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/file.txt/.."
| path basename
echo "some/file.txt/.."
| path basename
"#
));
@ -73,7 +73,7 @@ fn replaces_basename_of_path_ending_with_double_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/file.txt/.."
echo "some/file.txt/.."
| path basename -r eggs
"#
));

View File

@ -7,7 +7,7 @@ fn returns_dirname_of_empty_input() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo ""
echo ""
| path dirname
"#
));
@ -20,7 +20,7 @@ fn replaces_dirname_of_empty_input() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo ""
echo ""
| path dirname -r newdir
"#
));
@ -33,8 +33,8 @@ fn returns_dirname_of_path_ending_with_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/dir/."
| path dirname
echo "some/dir/."
| path dirname
"#
));
@ -46,7 +46,7 @@ fn replaces_dirname_of_path_ending_with_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/dir/."
echo "some/dir/."
| path dirname -r eggs
"#
));
@ -60,8 +60,8 @@ fn returns_dirname_of_path_ending_with_double_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/dir/.."
| path dirname
echo "some/dir/.."
| path dirname
"#
));
@ -73,7 +73,7 @@ fn replaces_dirname_of_path_with_double_dot() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "some/dir/.."
echo "some/dir/.."
| path dirname -r eggs
"#
));

View File

@ -14,7 +14,7 @@ fn expands_path_with_dot() {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "menu/./spam.txt"
echo "menu/./spam.txt"
| path expand
"#
));
@ -34,7 +34,7 @@ fn expands_path_with_double_dot() {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "menu/../menu/spam.txt"
echo "menu/../menu/spam.txt"
| path expand
"#
));

View File

@ -7,7 +7,7 @@ fn returns_type_of_missing_file() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "spam.txt"
echo "spam.txt"
| path type
"#
));
@ -27,7 +27,7 @@ fn returns_type_of_existing_file() {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "menu"
echo "menu"
| path type
"#
));
@ -48,7 +48,7 @@ fn returns_type_of_existing_directory() {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "menu/spam.txt"
echo "menu/spam.txt"
| path type
"#
));

View File

@ -32,11 +32,11 @@ fn condition_is_met() {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
open --raw ./caballeros.txt
| lines
| skip 2
open --raw ./caballeros.txt
| lines
| skip 2
| str trim
| str collect (char nl)
| str collect (char nl)
| from csv
| skip until "Chicken Collection" == "Red Chickens"
| skip 1

View File

@ -33,10 +33,10 @@ fn condition_is_met() {
cwd: dirs.test(), pipeline(
r#"
open --raw caballeros.txt
| lines
| skip 2
| lines
| skip 2
| str trim
| str collect (char nl)
| str collect (char nl)
| from csv
| skip while "Chicken Collection" != "Red Chickens"
| skip 1

View File

@ -41,15 +41,15 @@ fn zips_two_tables() {
&format!(
r#"
source {} ;
let contributors = ([
[name, commits];
[andres, 10]
[ jt, 20]
]);
let actual = ($contributors | add-commits 10);
expect $actual --to-eq [[name, commits]; [andres, 20] [jt, 30]]
"#,
dirs.test().join("zip_test.nu").display()