From 5d17b728525c51f63c128782f8819e6ab26d9569 Mon Sep 17 00:00:00 2001 From: morrme Date: Wed, 22 Jul 2020 16:42:04 -0500 Subject: [PATCH] update config documentation (#2178) * update config documentation * update config syntax * update config syntax * Update alias.md Co-authored-by: Jonathan Turner --- README.md | 6 +++--- crates/nu-cli/src/commands/config/remove.rs | 2 +- crates/nu-cli/src/commands/config/set_into.rs | 2 +- docs/commands/alias.md | 8 ++++---- docs/commands/config.md | 18 +++++++++--------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 76d7191677..5618c22d71 100644 --- a/README.md +++ b/README.md @@ -236,11 +236,11 @@ Here we use the variable `$it` to refer to the value being piped to the external Nu has early support for configuring the shell. You can refer to the book for a list of [all supported variables](https://www.nushell.sh/book/en/configuration.html). -To set one of these variables, you can use `config --set`. For example: +To set one of these variables, you can use `config set`. For example: ```shell -> config --set [edit_mode "vi"] -> config --set [path $nu.path] +> config set edit_mode "vi" +> config set path $nu.path ``` ### Shells diff --git a/crates/nu-cli/src/commands/config/remove.rs b/crates/nu-cli/src/commands/config/remove.rs index 57f8ecdf9c..9fd33f93ab 100644 --- a/crates/nu-cli/src/commands/config/remove.rs +++ b/crates/nu-cli/src/commands/config/remove.rs @@ -41,7 +41,7 @@ impl WholeStreamCommand for SubCommand { fn examples(&self) -> Vec { vec![Example { description: "Remove the startup commands", - example: "config --remove startup", + example: "config remove startup", result: None, }] } diff --git a/crates/nu-cli/src/commands/config/set_into.rs b/crates/nu-cli/src/commands/config/set_into.rs index f41d0043de..6210cc0959 100644 --- a/crates/nu-cli/src/commands/config/set_into.rs +++ b/crates/nu-cli/src/commands/config/set_into.rs @@ -60,7 +60,7 @@ pub async fn set_into( // existing config let mut result = crate::data::config::read(name_span, &None)?; - // In the original code, this is set to `Some` if the `--load flag is set` + // In the original code, this is set to `Some` if the `load flag is set` let configuration = None; let rows: Vec = input.collect().await; diff --git a/docs/commands/alias.md b/docs/commands/alias.md index 2af0eb2bb7..224f86ccc4 100644 --- a/docs/commands/alias.md +++ b/docs/commands/alias.md @@ -12,7 +12,7 @@ The command expects three parameters: ## Flags -* `-s`, `--save`: Save the alias to your config (see `config --path` to edit them later) +* `-s`, `--save`: Save the alias to your config (see `config path` to edit them later) ## Examples @@ -54,7 +54,7 @@ flags: Aliases are most useful when they are persistent. For that, add them to your startup config: ```shell -> config --set [startup ["alias myecho [msg] { echo $msg }"]] +> config set startup ["alias myecho [msg] { echo $msg }"] ``` This is fine for the first alias, but since it overwrites the startup config, you need a different approach for additional aliases. @@ -62,7 +62,7 @@ This is fine for the first alias, but since it overwrites the startup config, yo To add a 2nd alias: ```shell -> config --get startup | append "alias s [] { git status -sb }" | config --set_into startup +> config get startup | append "alias s [] { git status -sb }" | config set_into startup ``` This first reads the `startup` config (a table of strings), then appends another alias, then sets the `startup` config with the output of the pipeline. @@ -70,7 +70,7 @@ This first reads the `startup` config (a table of strings), then appends another To make this process easier, you could define another alias: ```shell -> alias addalias [alias-string] { config --get startup | append $alias-string | config --set_into startup } +> alias addalias [alias-string] { config get startup | append $alias-string | config set_into startup } ``` Then use that to add more aliases: diff --git a/docs/commands/config.md b/docs/commands/config.md index 06778eee13..1fbd429a46 100644 --- a/docs/commands/config.md +++ b/docs/commands/config.md @@ -6,25 +6,25 @@ Syntax: `config {flags}` ## Flags - --load + load load the config from the path give - --set - set a value in the config, eg) --set [key value] + set + set a value in the config, eg) set variable value - --set_into + set_into sets a variable from values in the pipeline - --get + get get a value from the config - --remove + remove remove a value from the config - --clear + clear clear the config - --path + path return the path to the config file ## Variables @@ -47,7 +47,7 @@ Syntax: `config {flags}` ## Examples ```shell -> config --set [table_mode "light"] +> config set table_mode "light" ``` A more detailed description on how to use this command to configure Nu shell can be found in the configuration chapter of [Nu Book](https://www.nushell.sh/book/en/configuration.html).