forked from extern/nushell
Size command: rename max length to bytes (#2473)
Since max length is just getting the byte length, rename to bytes in order to be more clear.
This commit is contained in:
parent
b5d591bb09
commit
f54cf8a096
@ -36,7 +36,7 @@ impl WholeStreamCommand for Size {
|
|||||||
"lines".to_string() => UntaggedValue::int(0).into(),
|
"lines".to_string() => UntaggedValue::int(0).into(),
|
||||||
"words".to_string() => UntaggedValue::int(7).into(),
|
"words".to_string() => UntaggedValue::int(7).into(),
|
||||||
"chars".to_string() => UntaggedValue::int(38).into(),
|
"chars".to_string() => UntaggedValue::int(38).into(),
|
||||||
"max length".to_string() => UntaggedValue::int(38).into(),
|
"bytes".to_string() => UntaggedValue::int(38).into(),
|
||||||
})
|
})
|
||||||
.into()]),
|
.into()]),
|
||||||
}]
|
}]
|
||||||
@ -96,7 +96,7 @@ fn count(contents: &str, tag: impl Into<Tag>) -> Value {
|
|||||||
dict.insert_untagged("lines", UntaggedValue::int(lines));
|
dict.insert_untagged("lines", UntaggedValue::int(lines));
|
||||||
dict.insert_untagged("words", UntaggedValue::int(words));
|
dict.insert_untagged("words", UntaggedValue::int(words));
|
||||||
dict.insert_untagged("chars", UntaggedValue::int(chars));
|
dict.insert_untagged("chars", UntaggedValue::int(chars));
|
||||||
dict.insert_untagged("max length", UntaggedValue::int(bytes));
|
dict.insert_untagged("bytes", UntaggedValue::int(bytes));
|
||||||
|
|
||||||
dict.into_value()
|
dict.into_value()
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
> open --raw Cargo.toml | size | debug
|
> open --raw Cargo.toml | size | debug
|
||||||
(lines=139 words=560 chars=4607 max length=4607)
|
(lines=139 words=560 chars=4607 bytes=4607)
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -134,7 +134,7 @@ To get the average of the file sizes in a directory, simply pipe the size column
|
|||||||
```shell
|
```shell
|
||||||
> pwd | split row / | size
|
> pwd | split row / | size
|
||||||
───┬───────┬───────┬───────┬────────────
|
───┬───────┬───────┬───────┬────────────
|
||||||
# │ lines │ words │ chars │ max length
|
# │ lines │ words │ chars │ bytes
|
||||||
───┼───────┼───────┼───────┼────────────
|
───┼───────┼───────┼───────┼────────────
|
||||||
0 │ 0 │ 1 │ 5 │ 5
|
0 │ 0 │ 1 │ 5 │ 5
|
||||||
1 │ 0 │ 1 │ 11 │ 11
|
1 │ 0 │ 1 │ 11 │ 11
|
||||||
@ -151,7 +151,7 @@ To get the average of the file sizes in a directory, simply pipe the size column
|
|||||||
lines │ 0
|
lines │ 0
|
||||||
words │ 2
|
words │ 2
|
||||||
chars │ 12
|
chars │ 12
|
||||||
max length │ 12
|
bytes │ 12
|
||||||
────────────┴────
|
────────────┴────
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ To get the average of the file sizes in a directory, simply pipe the size column
|
|||||||
lines │ 0.0000
|
lines │ 0.0000
|
||||||
words │ 1.1666
|
words │ 1.1666
|
||||||
chars │ 8.3333
|
chars │ 8.3333
|
||||||
max length │ 8.3333
|
bytes │ 8.3333
|
||||||
────────────┴────────
|
────────────┴────────
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ This commands gives word count statistics on any text.
|
|||||||
```shell
|
```shell
|
||||||
> open lalala.txt | size
|
> open lalala.txt | size
|
||||||
━━━━━━━┯━━━━━━━┯━━━━━━━┯━━━━━━━━━━━━
|
━━━━━━━┯━━━━━━━┯━━━━━━━┯━━━━━━━━━━━━
|
||||||
lines │ words │ chars │ max length
|
lines │ words │ chars │ bytes
|
||||||
───────┼───────┼───────┼────────────
|
───────┼───────┼───────┼────────────
|
||||||
4 │ 10 │ 72 │ 72
|
4 │ 10 │ 72 │ 72
|
||||||
━━━━━━━┷━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━
|
━━━━━━━┷━━━━━━━┷━━━━━━━┷━━━━━━━━━━━━
|
||||||
@ -16,7 +16,7 @@ This commands gives word count statistics on any text.
|
|||||||
```shell
|
```shell
|
||||||
> open the_mysterious_affair_at_styles.txt | size
|
> open the_mysterious_affair_at_styles.txt | size
|
||||||
━━━━━━━┯━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━
|
━━━━━━━┯━━━━━━━┯━━━━━━━━┯━━━━━━━━━━━━
|
||||||
lines │ words │ chars │ max length
|
lines │ words │ chars │ bytes
|
||||||
───────┼───────┼────────┼────────────
|
───────┼───────┼────────┼────────────
|
||||||
8935 │ 62352 │ 349459 │ 361771
|
8935 │ 62352 │ 349459 │ 361771
|
||||||
━━━━━━━┷━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━
|
━━━━━━━┷━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━━
|
||||||
|
Loading…
Reference in New Issue
Block a user