-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(system): add mise system use and mise system upgrade #10346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise system upgrade` | ||
|
|
||
| - **Usage**: `mise system upgrade [FLAGS] [PACKAGE]…` | ||
| - **Aliases**: `up` | ||
| - **Source code**: [`src/cli/system/upgrade.rs`](https://github.com/jdx/mise/blob/main/src/cli/system/upgrade.rs) | ||
|
|
||
| Upgrade installed system packages from `[system.packages]` | ||
|
|
||
| Refreshes package manager metadata and upgrades the configured packages | ||
| that are already installed: apt/dnf/pacman upgrade to the newest available | ||
| version (or to the version pinned in config), brew pours the formula's | ||
| current bottle and replaces the old keg. Packages that are not installed | ||
| yet are skipped — use `mise system install` for those. | ||
|
|
||
| Packages can also be given explicitly in `manager:package` form. | ||
|
|
||
| ## Arguments | ||
|
|
||
| ### `[PACKAGE]…` | ||
|
|
||
| Packages in `manager:package` form; defaults to everything configured in [system.packages] | ||
|
|
||
| ## Flags | ||
|
|
||
| ### `-m --manager <MANAGER>` | ||
|
|
||
| Only upgrade packages for this manager, e.g. `apt` or `brew` | ||
|
|
||
| **Choices:** | ||
|
|
||
| - `apt` | ||
| - `brew` | ||
| - `dnf` | ||
| - `pacman` | ||
|
|
||
| ### `-n --dry-run` | ||
|
|
||
| Print the commands that would run without running them | ||
|
|
||
| ### `-y --yes` | ||
|
|
||
| Skip the confirmation prompt | ||
|
|
||
| Examples: | ||
|
|
||
| ``` | ||
| mise system upgrade | ||
| mise system upgrade brew:postgresql@17 | ||
| mise system upgrade --manager apt --yes | ||
| mise system upgrade --dry-run | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise system use` | ||
|
|
||
| - **Usage**: `mise system use [FLAGS] <PACKAGE>…` | ||
| - **Aliases**: `u` | ||
| - **Source code**: [`src/cli/system/use.rs`](https://github.com/jdx/mise/blob/main/src/cli/system/use.rs) | ||
|
|
||
| Add system packages to [system.packages] and install them | ||
|
|
||
| Like `mise use` for tools: writes `"manager:package" = "version"` entries | ||
| to mise.toml (the local config by default, the global one with `-g`) and | ||
| then installs whatever is missing. | ||
|
|
||
| Versions are pinned with `@`: `mise system use apt:curl@8.5.0-2`. Without | ||
| `@` (or with `@latest`) no pin is written. brew formulae version through | ||
| their names instead (`brew:postgresql@17`), so `@` is always part of the | ||
| formula name there. | ||
|
|
||
| ## Arguments | ||
|
|
||
| ### `<PACKAGE>…` | ||
|
|
||
| Packages in `manager:package[@version]` form | ||
|
|
||
| ## Flags | ||
|
|
||
| ### `-g --global` | ||
|
|
||
| Write to the global config (~/.config/mise/config.toml) instead of the local one | ||
|
|
||
| ### `-p --path <PATH>` | ||
|
|
||
| Write to this config file or directory | ||
|
|
||
| ### `-e --env <ENV>` | ||
|
|
||
| Write to the config file for this environment (mise.<ENV>.toml) | ||
|
|
||
| ### `-n --dry-run` | ||
|
|
||
| Print the commands that would run without writing config or installing | ||
|
|
||
| ### `-y --yes` | ||
|
|
||
| Skip the confirmation prompt | ||
|
|
||
| Examples: | ||
|
|
||
| ``` | ||
| mise system use apt:curl brew:jq | ||
| mise system use -g brew:postgresql@17 | ||
| mise system use apt:curl@8.5.0-2 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # `mise system use` config-writing works on any platform — managers that | ||
| # aren't available on this machine are added to the config without installing | ||
| # (brew specs are avoided here: even a dry-run resolves the formula closure | ||
| # over the network) | ||
|
|
||
| # dry-run prints what would be written without creating the file | ||
| assert_contains "mise system use --dry-run apt:zlib1g-dev" '"apt:zlib1g-dev" = "latest"' | ||
| assert_fail "cat mise.toml" | ||
|
|
||
| # version pins use @, like mise use | ||
| assert_contains "mise system use --dry-run apt:curl@8.5.0-2" '"apt:curl" = "8.5.0-2"' | ||
|
|
||
| # bad specs and unknown managers fail before anything is written | ||
| assert_fail "mise system use noprefix" | ||
| assert_fail "mise system use not-a-real-manager:pkg" | ||
| assert_fail "cat mise.toml" | ||
|
|
||
| # writes the entry even when the manager isn't available on this machine | ||
| # (guarded so a real Arch box doesn't actually install ripgrep) | ||
| if ! command -v pacman >/dev/null; then | ||
| assert_succeed "mise system use --yes pacman:ripgrep" | ||
| assert_contains "cat mise.toml" '"pacman:ripgrep" = "latest"' | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.