-
-
Notifications
You must be signed in to change notification settings - Fork 779
feat(plugins/mise): add mise plugin #744
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
Open
andremmfaria
wants to merge
2
commits into
ohmybash:master
Choose a base branch
from
andremmfaria:feat/plugins-mise
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # mise plugin | ||
|
|
||
| Add [oh-my-bash](https://ohmybash.github.io) integration with [mise](https://mise.jdx.dev), a polyglot tool version manager for Node.js, Python, Ruby, Go, and more. mise is a faster, drop-in replacement for [asdf](https://asdf-vm.com) that also supports `.tool-versions` files. | ||
|
|
||
| ## Installation | ||
|
|
||
| 1. [Install mise](https://mise.jdx.dev/getting-started.html) by running the following: | ||
|
|
||
| ```bash | ||
| curl https://mise.run | sh | ||
| ``` | ||
|
|
||
| 2. Enable the plugin by adding it to your oh-my-bash `plugins` definition in `~/.bashrc`. | ||
|
|
||
| ```sh | ||
| plugins=(mise) | ||
| ``` | ||
|
|
||
| The plugin resolves the mise binary automatically — no manual `eval` line in `~/.bashrc` is needed. It checks the following locations in order: | ||
|
|
||
| 1. `mise` on `$PATH` (system package managers: apt, brew, dnf, pacman, etc.) | ||
| 2. `$MISE_INSTALL_PATH` (custom install path set at install time) | ||
| 3. `~/.local/bin/mise` (default location for `curl https://mise.run | sh`) | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Quiet mode | ||
|
|
||
| By default, mise may print a message when activated. To suppress this, set the following variable **before** the `source` line in your `~/.bashrc`: | ||
|
|
||
| ```sh | ||
| OMB_PLUGIN_MISE_QUIET=true | ||
| ``` | ||
|
|
||
| ## Aliases | ||
|
|
||
| All aliases target the resolved mise binary, so they work regardless of whether mise is on `$PATH`. | ||
|
|
||
| | Alias | Command | Description | | ||
| |--------|-------------------|------------------------------------------| | ||
| | `mi` | `mise install` | Install tool versions defined in config | | ||
| | `mu` | `mise use` | Set a tool version in the config file | | ||
| | `mr` | `mise run` | Run a task defined in `mise.toml` | | ||
| | `mex` | `mise exec` | Run a command in the mise environment | | ||
| | `mls` | `mise ls` | List installed tool versions | | ||
| | `mlsr` | `mise ls-remote` | List available remote versions | | ||
|
|
||
| ## Usage | ||
|
|
||
| See the [mise documentation](https://mise.jdx.dev/getting-started.html) for full usage: | ||
|
|
||
| ```bash | ||
| mi node@22 # mise install node@22 | ||
| mu node@lts # mise use node@lts | ||
| mex -- node --version | ||
| ``` |
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,37 @@ | ||
| #! bash oh-my-bash.module | ||
| # Description: Integrate mise (https://mise.jdx.dev), a polyglot tool version manager | ||
| # | ||
| # @var[opt] OMB_PLUGIN_MISE_QUIET set to 'true' to suppress mise activation output | ||
|
|
||
| # Resolve the mise binary: check PATH first, then the default install location | ||
| # used by the official installer (curl https://mise.run | sh), then any custom | ||
| # install path set via MISE_INSTALL_PATH. | ||
| _omb_plugin_mise_bin= | ||
| if _omb_util_command_exists mise; then | ||
| _omb_plugin_mise_bin=mise | ||
| elif [[ -x "${MISE_INSTALL_PATH:-}" ]]; then | ||
| _omb_plugin_mise_bin=$MISE_INSTALL_PATH | ||
| elif [[ -x "$HOME/.local/bin/mise" ]]; then | ||
| _omb_plugin_mise_bin=$HOME/.local/bin/mise | ||
| fi | ||
|
|
||
| if [[ -n $_omb_plugin_mise_bin ]]; then | ||
| if [[ ${OMB_PLUGIN_MISE_QUIET-} == true ]]; then | ||
| eval "$("$_omb_plugin_mise_bin" activate bash --quiet)" | ||
| else | ||
| eval "$("$_omb_plugin_mise_bin" activate bash)" | ||
| fi | ||
|
|
||
| # Use the resolved binary path in aliases so they work even when mise is | ||
| # not yet on $PATH (e.g. installed via MISE_INSTALL_PATH or ~/.local/bin). | ||
| local _omb_plugin_mise_bin_q | ||
| printf -v _omb_plugin_mise_bin_q '%q' "$_omb_plugin_mise_bin" | ||
| alias mi="$_omb_plugin_mise_bin_q install" | ||
| alias mu="$_omb_plugin_mise_bin_q use" | ||
| alias mr="$_omb_plugin_mise_bin_q run" | ||
| alias mex="$_omb_plugin_mise_bin_q exec" | ||
| alias mls="$_omb_plugin_mise_bin_q ls" | ||
| alias mlsr="$_omb_plugin_mise_bin_q ls-remote" | ||
| unset -v _omb_plugin_mise_bin_q | ||
| fi | ||
| unset _omb_plugin_mise_bin | ||
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.