mirror of
https://github.com/nushell/nushell.git
synced 2025-02-24 14:31:47 +01:00
Update alias docs (#2925)
This commit is contained in:
parent
4f2ae34df9
commit
63a62e19f9
@ -1,18 +1,14 @@
|
|||||||
# alias
|
# alias
|
||||||
|
|
||||||
This command allows you to define shortcuts for other common commands. By default, they only apply to the current session. To persist them, add `--save`.
|
This command allows you to define shortcuts for other common commands. By default, they only apply to the current session. To persist them, add them to your config.
|
||||||
|
|
||||||
Syntax: `alias {flags} <name> = <body>`
|
Syntax: `alias <name> = <body>`
|
||||||
|
|
||||||
The command expects two parameters:
|
The command expects two parameters:
|
||||||
|
|
||||||
* The name of the alias
|
* The name of the alias
|
||||||
* The body of the alias
|
* The body of the alias
|
||||||
|
|
||||||
## Flags
|
|
||||||
|
|
||||||
* `-s`, `--save`: Save the alias to your config (see `config path` to edit them later)
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Define a custom `myecho` command as an alias:
|
Define a custom `myecho` command as an alias:
|
||||||
@ -34,18 +30,3 @@ Usage:
|
|||||||
flags:
|
flags:
|
||||||
-h, --help: Display this help message
|
-h, --help: Display this help message
|
||||||
```
|
```
|
||||||
|
|
||||||
## Persistent aliases
|
|
||||||
|
|
||||||
Aliases are most useful when they are persistent. For that, use the `--save` flag:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
> alias --save myecho = echo
|
|
||||||
```
|
|
||||||
|
|
||||||
This will store the alias in your config, under the `startup` key. To edit the saved alias, run it again with the same name, or edit your config file directly. You can find the location of the file using `config path`.
|
|
||||||
|
|
||||||
For example, to edit your config file in `vi`, run:
|
|
||||||
```shell
|
|
||||||
> vi $(config path)
|
|
||||||
```
|
|
||||||
|
Loading…
Reference in New Issue
Block a user