mirror of
https://github.com/nushell/nushell.git
synced 2025-05-01 00:24:29 +02:00
Docs autoview pwd touch (#2068)
* [ADD] Add draft documentation for autoview * [ADD] Add draft documentation for pwd * [ADD] Add draft documentation for touch * [MOD] Improve description and add examples Add the use of `textview` and `binaryview`. Add examples for single value, source file and binary file.
This commit is contained in:
parent
a30901ff7d
commit
821d44af54
59
docs/commands/autoview.md
Normal file
59
docs/commands/autoview.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# autoview
|
||||||
|
|
||||||
|
Print the content of the pipeline as a table or list.
|
||||||
|
It is the implied or default viewer when none is provided.
|
||||||
|
|
||||||
|
When reading a single value, a table or a list, `autoview` will attempt to view it.
|
||||||
|
When reading a string that originally comes from a source file it will attempt
|
||||||
|
to use `textview`.
|
||||||
|
When reading a binary file it will attempt to display its content as hexadecimal
|
||||||
|
numbers and the corresponding characters.
|
||||||
|
|
||||||
|
`-h`, `--help`
|
||||||
|
Display help message.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
In all following examples `autoview` can be removed with no change in the output.
|
||||||
|
The use of `autoview` at the end of the pipeline is implied when no viewer is
|
||||||
|
explicitly used.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> which nu | get path | autoview
|
||||||
|
/home/me/.cargo/bin/nu
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> ls | autoview
|
||||||
|
────┬────────────────────┬──────┬─────────┬──────────────
|
||||||
|
# │ name │ type │ size │ modified
|
||||||
|
────┼────────────────────┼──────┼─────────┼──────────────
|
||||||
|
0 │ README.md │ File │ 932 B │ 19 hours ago
|
||||||
|
1 │ alias.md │ File │ 2.0 KB │ 19 hours ago
|
||||||
|
2 │ append.md │ File │ 1.4 KB │ 19 hours ago
|
||||||
|
...
|
||||||
|
82 │ wrap.md │ File │ 1.8 KB │ 19 hours ago
|
||||||
|
────┴────────────────────┴──────┴─────────┴──────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> echo "# Hi" "## Section" "Some text" | save file.md
|
||||||
|
> open file.md | autoview
|
||||||
|
# Hi
|
||||||
|
## Section
|
||||||
|
Some text
|
||||||
|
```
|
||||||
|
|
||||||
|
`autoview` will use `textview` to colorize the text based on the file format.
|
||||||
|
The style used by `textview` can be configured in `config.toml`.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> open --raw $(which nu | get path) | autoview
|
||||||
|
...
|
||||||
|
126d1c0: 64 31 66 37 62 30 31 63 36 2e 31 31 38 2e 6c 6c d1f7b01c6.118.ll
|
||||||
|
126d1d0: 76 6d 2e 34 34 38 37 35 37 31 32 34 39 35 33 39 vm.4487571249539
|
||||||
|
126d1e0: 34 34 30 34 30 39 00 61 6e 6f 6e 2e 30 30 61 63 440409.anon.00ac
|
||||||
|
126d1f0: 37 32 65 36 37 66 32 31 39 34 62 32 32 61 61 63 72e67f2194b22aac
|
||||||
|
126d200: 62 35 39 37 33 36 30 62 64 31 39 38 2e 31 36 2e b597360bd198.16.
|
||||||
|
...
|
||||||
|
```
|
27
docs/commands/pwd.md
Normal file
27
docs/commands/pwd.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# pwd
|
||||||
|
|
||||||
|
Print the current working directory.
|
||||||
|
|
||||||
|
`-h`, `--help`
|
||||||
|
Display help message.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> pwd
|
||||||
|
/home/me/nushell/docs/commands
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> pwd | split column "/" | reject Column1 | pivot | reject Column0
|
||||||
|
───┬──────────
|
||||||
|
# │ Column1
|
||||||
|
───┼──────────
|
||||||
|
0 │ home
|
||||||
|
1 │ me
|
||||||
|
2 │ projects
|
||||||
|
3 │ nushell
|
||||||
|
4 │ docs
|
||||||
|
5 │ commands
|
||||||
|
───┴──────────
|
||||||
|
```
|
43
docs/commands/touch.md
Normal file
43
docs/commands/touch.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# touch
|
||||||
|
|
||||||
|
Create a file in the current or an already existent directory.
|
||||||
|
It has no effect on existing files.
|
||||||
|
Unlike GNU touch, the access time and the modified time are not updated.
|
||||||
|
|
||||||
|
`-h`, `--help`
|
||||||
|
Display help message.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Create a file in an empty folder. Then touch the file and list files again to observe that the modified time has not been updated.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> ls
|
||||||
|
> touch file.ext; ls
|
||||||
|
──────────┬─────────────
|
||||||
|
name │ file.ext
|
||||||
|
type │ File
|
||||||
|
size │ 0 B
|
||||||
|
modified │ 0 secs ago
|
||||||
|
──────────┴─────────────
|
||||||
|
> touch file.ext; ls
|
||||||
|
──────────┬───────────
|
||||||
|
name │ file.ext
|
||||||
|
type │ File
|
||||||
|
size │ 0 B
|
||||||
|
modified │ 10 secs ago
|
||||||
|
──────────┴───────────
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a file within an already existent folder.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> mkdir dir
|
||||||
|
> touch dir/file.ext; ls dir
|
||||||
|
──────────┬───────────
|
||||||
|
name │ dir/file.ext
|
||||||
|
type │ File
|
||||||
|
size │ 0 B
|
||||||
|
modified │ 0 secs ago
|
||||||
|
──────────┴───────────
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user