Skip to content

Commit

Permalink
feat: added --type option to toml set (#2674)
Browse files Browse the repository at this point in the history
Fixes #2668
  • Loading branch information
jdx authored Sep 27, 2024
1 parent d396bcb commit 23e5ee2
Show file tree
Hide file tree
Showing 20 changed files with 334 additions and 305 deletions.
5 changes: 3 additions & 2 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 7 additions & 12 deletions docs/.vitepress/cli_commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down Expand Up @@ -238,17 +244,6 @@ export const commands: { [key: string]: Command } = {
},
},
},
"toml": {
hide: false,
subcommands: {
"get": {
hide: false,
},
"set": {
hide: false,
},
},
},
"trust": {
hide: false,
},
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/config/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Aliases:** `g`

```text
[experimental] Generate an .mise.toml file
[experimental] Generate a mise.toml file
Usage: config generate [OPTIONS]
Expand Down
9 changes: 5 additions & 4 deletions docs/cli/toml/get.md → docs/cli/config/get.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
## `mise toml get <KEY> [FILE]`
## `mise config get [OPTIONS] [KEY]`

```text
Display the value of a setting in a mise.toml file
Usage: toml get <KEY> [FILE]
Usage: config get [OPTIONS] [KEY]
Arguments:
<KEY>
[KEY]
The path of the config to display
[FILE]
Options:
-f, --file <FILE>
The path to the mise.toml file to edit
If not provided, the nearest mise.toml file will be used
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/config/ls.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## `mise config ls [OPTIONS]` <Badge type="warning" text="experimental" />
## `mise config ls [OPTIONS]`

```text
[experimental] List config files currently in use
List config files currently in use
Usage: config ls [OPTIONS]
Expand Down
30 changes: 30 additions & 0 deletions docs/cli/config/set.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## `mise config set [OPTIONS] <KEY> <VALUE>`

```text
Display the value of a setting in a mise.toml file
Usage: config set [OPTIONS] <KEY> <VALUE>
Arguments:
<KEY>
The path of the config to display
<VALUE>
The value to set the key to
Options:
-f, --file <FILE>
The path to the mise.toml file to edit
If not provided, the nearest mise.toml file will be used
-t, --type <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
```
124 changes: 65 additions & 59 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,52 @@ Examples:
$ mise completion fish > ~/.config/fish/completions/mise.fish
```

## `mise config ls [OPTIONS]` <Badge type="warning" text="experimental" />
## `mise config generate [OPTIONS]` <Badge type="warning" text="experimental" />

**Aliases:** `g`

```text
[experimental] List config files currently in use
[experimental] Generate a mise.toml file
Usage: config generate [OPTIONS]
Options:
-o, --output <OUTPUT>
Output to file instead of stdout
Examples:
$ mise cf generate > .mise.toml
$ mise cf generate --output=.mise.toml
```

## `mise config get [OPTIONS] [KEY]`

```text
Display the value of a setting in a mise.toml file
Usage: config get [OPTIONS] [KEY]
Arguments:
[KEY]
The path of the config to display
Options:
-f, --file <FILE>
The path to the mise.toml file to edit
If not provided, the nearest mise.toml file will be used
Examples:
$ mise toml get tools.python
3.12
```

## `mise config ls [OPTIONS]`

```text
List config files currently in use
Usage: config ls [OPTIONS]
Expand All @@ -253,23 +295,35 @@ Examples:
$ mise config ls
```

## `mise config generate [OPTIONS]` <Badge type="warning" text="experimental" />

**Aliases:** `g`
## `mise config set [OPTIONS] <KEY> <VALUE>`

```text
[experimental] Generate an .mise.toml file
Display the value of a setting in a mise.toml file
Usage: config generate [OPTIONS]
Usage: config set [OPTIONS] <KEY> <VALUE>
Arguments:
<KEY>
The path of the config to display
<VALUE>
The value to set the key to
Options:
-o, --output <OUTPUT>
Output to file instead of stdout
-f, --file <FILE>
The path to the mise.toml file to edit
If not provided, the nearest mise.toml file will be used
-t, --type <TYPE>
[default: string]
[possible values: string, integer, float, bool]
Examples:
$ mise cf generate > .mise.toml
$ mise cf generate --output=.mise.toml
$ mise config set tools.python 3.12
$ mise config set settings.always_keep_download true
$ mise config set env.TEST_ENV_VAR ABC
```

## `mise current [PLUGIN]`
Expand Down Expand Up @@ -1603,54 +1657,6 @@ Examples:
$ mise tasks cmd1 arg1 arg2 ::: cmd2 arg1 arg2
```

## `mise toml get <KEY> [FILE]`

```text
Display the value of a setting in a mise.toml file
Usage: toml get <KEY> [FILE]
Arguments:
<KEY>
The path of the config to display
[FILE]
The path to the mise.toml file to edit
If not provided, the nearest mise.toml file will be used
Examples:
$ mise toml get tools.python
3.12
```

## `mise toml set <KEY> <VALUE> [FILE]`

```text
Display the value of a setting in a mise.toml file
Usage: toml set <KEY> <VALUE> [FILE]
Arguments:
<KEY>
The path of the config to display
<VALUE>
The value to set the key to
[FILE]
The path to the mise.toml file to edit
If not provided, the nearest mise.toml file will be used
Examples:
$ mise toml set tools.python 3.12
$ mise toml set settings.always_keep_download true
$ mise toml set env.TEST_ENV_VAR ABC
```

## `mise trust [OPTIONS] [CONFIG_FILE]`

```text
Expand Down
25 changes: 0 additions & 25 deletions docs/cli/toml/set.md

This file was deleted.

5 changes: 1 addition & 4 deletions man/man1/mise.1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mise\-completion(1)
Generate shell completions
.TP
mise\-config(1)
[experimental] Manage config files
Manage config files
.TP
mise\-current(1)
Shows current active and installed runtime versions
Expand Down Expand Up @@ -134,9 +134,6 @@ Add tool versions from external tools to mise
mise\-tasks(1)
[experimental] Manage tasks
.TP
mise\-toml(1)
Edit mise.toml files
.TP
mise\-trust(1)
Marks a config file as trusted
.TP
Expand Down
Loading

0 comments on commit 23e5ee2

Please sign in to comment.