From 23e5ee255d2dae432f777c32a9f9fa305a251406 Mon Sep 17 00:00:00 2001
From: jdx <216188+jdx@users.noreply.github.com>
Date: Fri, 27 Sep 2024 16:02:03 -0500
Subject: [PATCH] feat: added --type option to `toml set` (#2674)
Fixes #2668
---
.idea/prettier.xml | 5 +-
docs/.vitepress/cli_commands.ts | 19 +--
docs/cli/config/generate.md | 2 +-
docs/cli/{toml => config}/get.md | 9 +-
docs/cli/config/ls.md | 4 +-
docs/cli/config/set.md | 30 +++++
docs/cli/index.md | 124 +++++++++---------
docs/cli/toml/set.md | 25 ----
man/man1/mise.1 | 5 +-
mise.usage.kdl | 68 +++++-----
src/cli/config/generate.rs | 2 +-
src/cli/{toml => config}/get.rs | 22 ++--
src/cli/config/ls.rs | 9 +-
src/cli/config/mod.rs | 32 ++++-
src/cli/config/set.rs | 106 +++++++++++++++
...se__cli__config__get__tests__toml_get.snap | 25 ++++
src/cli/mod.rs | 3 -
src/cli/toml/mod.rs | 62 ---------
src/cli/toml/set.rs | 79 -----------
src/config/config_file/mise_toml.rs | 8 +-
20 files changed, 334 insertions(+), 305 deletions(-)
rename docs/cli/{toml => config}/get.md (73%)
create mode 100644 docs/cli/config/set.md
delete mode 100644 docs/cli/toml/set.md
rename src/cli/{toml => config}/get.rs (76%)
create mode 100644 src/cli/config/set.rs
create mode 100644 src/cli/config/snapshots/mise__cli__config__get__tests__toml_get.snap
delete mode 100644 src/cli/toml/mod.rs
delete mode 100644 src/cli/toml/set.rs
diff --git a/.idea/prettier.xml b/.idea/prettier.xml
index ed1abca792..f89a64058a 100644
--- a/.idea/prettier.xml
+++ b/.idea/prettier.xml
@@ -1,8 +1,9 @@
-
+
+
-
+
\ No newline at end of file
diff --git a/docs/.vitepress/cli_commands.ts b/docs/.vitepress/cli_commands.ts
index d76f76d18e..2156705d3a 100644
--- a/docs/.vitepress/cli_commands.ts
+++ b/docs/.vitepress/cli_commands.ts
@@ -59,10 +59,16 @@ export const commands: { [key: string]: Command } = {
"config": {
hide: false,
subcommands: {
+ "generate": {
+ hide: false,
+ },
+ "get": {
+ hide: false,
+ },
"ls": {
hide: false,
},
- "generate": {
+ "set": {
hide: false,
},
},
@@ -238,17 +244,6 @@ export const commands: { [key: string]: Command } = {
},
},
},
- "toml": {
- hide: false,
- subcommands: {
- "get": {
- hide: false,
- },
- "set": {
- hide: false,
- },
- },
- },
"trust": {
hide: false,
},
diff --git a/docs/cli/config/generate.md b/docs/cli/config/generate.md
index 144db72d1d..ff6de06329 100644
--- a/docs/cli/config/generate.md
+++ b/docs/cli/config/generate.md
@@ -3,7 +3,7 @@
**Aliases:** `g`
```text
-[experimental] Generate an .mise.toml file
+[experimental] Generate a mise.toml file
Usage: config generate [OPTIONS]
diff --git a/docs/cli/toml/get.md b/docs/cli/config/get.md
similarity index 73%
rename from docs/cli/toml/get.md
rename to docs/cli/config/get.md
index 74f2e7d3f5..4b7d8166a9 100644
--- a/docs/cli/toml/get.md
+++ b/docs/cli/config/get.md
@@ -1,15 +1,16 @@
-## `mise toml get [FILE]`
+## `mise config get [OPTIONS] [KEY]`
```text
Display the value of a setting in a mise.toml file
-Usage: toml get [FILE]
+Usage: config get [OPTIONS] [KEY]
Arguments:
-
+ [KEY]
The path of the config to display
- [FILE]
+Options:
+ -f, --file
The path to the mise.toml file to edit
If not provided, the nearest mise.toml file will be used
diff --git a/docs/cli/config/ls.md b/docs/cli/config/ls.md
index 87b988dd74..acb08860d8 100644
--- a/docs/cli/config/ls.md
+++ b/docs/cli/config/ls.md
@@ -1,7 +1,7 @@
-## `mise config ls [OPTIONS]`
+## `mise config ls [OPTIONS]`
```text
-[experimental] List config files currently in use
+List config files currently in use
Usage: config ls [OPTIONS]
diff --git a/docs/cli/config/set.md b/docs/cli/config/set.md
new file mode 100644
index 0000000000..f0510d7f2e
--- /dev/null
+++ b/docs/cli/config/set.md
@@ -0,0 +1,30 @@
+## `mise config set [OPTIONS] `
+
+```text
+Display the value of a setting in a mise.toml file
+
+Usage: config set [OPTIONS]
+
+Arguments:
+
+ The path of the config to display
+
+
+ The value to set the key to
+
+Options:
+ -f, --file
+ The path to the mise.toml file to edit
+
+ If not provided, the nearest mise.toml file will be used
+
+ -t, --type
+ [default: string]
+ [possible values: string, integer, float, bool]
+
+Examples:
+
+ $ mise config set tools.python 3.12
+ $ mise config set settings.always_keep_download true
+ $ mise config set env.TEST_ENV_VAR ABC
+```
diff --git a/docs/cli/index.md b/docs/cli/index.md
index 7824970390..438214be56 100644
--- a/docs/cli/index.md
+++ b/docs/cli/index.md
@@ -237,10 +237,52 @@ Examples:
$ mise completion fish > ~/.config/fish/completions/mise.fish
```
-## `mise config ls [OPTIONS]`
+## `mise config generate [OPTIONS]`
+
+**Aliases:** `g`
```text
-[experimental] List config files currently in use
+[experimental] Generate a mise.toml file
+
+Usage: config generate [OPTIONS]
+
+Options:
+ -o, --output