Auto-generate markdown command docs (#4451)

* Finish updating

* a couple improvements

* Update renames

* cleanup examples
This commit is contained in:
JT
2022-02-13 21:22:51 -05:00
committed by GitHub
parent 06f5affc0b
commit 8c0a2d3c15
478 changed files with 7676 additions and 8045 deletions

View File

@@ -1,105 +1,25 @@
# which
---
title: which
layout: command
version: 0.59.0
---
Finds a program file.
Finds a program file, alias or custom command.
Usage:
> which <application> {flags}
## Signature
```> which (application) ...rest --all```
## Parameters
- application: the name of the command to find the path to
## Flags
- --all: list all executables
- `application`: application
- `...rest`: additional applications
- `--all`: list all executables
## Examples
`which` finds the location of an executable:
Find if the 'myapp' application is available
```shell
> which python
─────────┬─────────────────
arg │ python
path │ /usr/bin/python
builtinfalse
─────────┴─────────────────
> which myapp
```
```shell
> which cargo
─────────┬────────────────────────────
arg │ cargo
path │ /home/bob/.cargo/bin/cargo
builtinfalse
─────────┴────────────────────────────
```
`which` will identify nushell commands:
```shell
> which ls
─────────┬──────────────────────────
arg │ ls
path │ nushell built-in command
builtintrue
─────────┴──────────────────────────
```
```shell
> which which
─────────┬──────────────────────────
arg │ which
path │ nushell built-in command
builtintrue
─────────┴──────────────────────────
```
Passing the `all` flag identifies all instances of a command or binary
```shell
> which ls --all
───┬─────┬──────────────────────────┬─────────
# │ arg │ path │ builtin
───┼─────┼──────────────────────────┼─────────
0 │ ls │ nushell built-in commandtrue
1 │ ls │ /bin/ls │ false
───┴─────┴──────────────────────────┴─────────
```
`which` will also identify local binaries
```shell
> touch foo
> chmod +x foo
> which ./foo
─────────┬────────────────────────────────
arg │ ./foo
path │ /Users/josephlyons/Desktop/foo
builtinfalse
─────────┴────────────────────────────────
```
`which` also identifies aliases
```shell
> alias e = echo
> which e
───┬─────┬───────────────┬─────────
# │ arg │ path │ builtin
───┼─────┼───────────────┼─────────
0 │ e │ Nushell aliasfalse
───┴─────┴───────────────┴─────────
```
and custom commands
```shell
> def my_cool_echo [arg] { echo $arg }
> which my_cool_echo
───┬──────────────┬────────────────────────┬─────────
# │ arg │ path │ builtin
───┼──────────────┼────────────────────────┼─────────
0 │ my_cool_echo │ Nushell custom commandfalse
───┴──────────────┴────────────────────────┴─────────
```