feat(tools): migrate to mise (formally known as rtx)

This commit is contained in:
2024-01-06 18:59:12 +00:00
parent f4ce515973
commit bf92527b6a
7 changed files with 32 additions and 26 deletions

View File

@@ -1,3 +1,3 @@
# Default Gems installed by rtx when installing new Ruby versions.
# Default Gems installed by mise when installing new Ruby versions.
foreman
rubocop

View File

@@ -1,4 +1,4 @@
# Default Go packages installed by rtx when installing new Go versions.
# Default Go packages installed by mise when installing new Go versions.
github.com/nametake/golangci-lint-langserver@latest
golang.org/x/tools/cmd/goimports@latest
golang.org/x/tools/gopls@latest

View File

@@ -15,7 +15,7 @@ SYMLINKS=(
bitbar
coffeelint.json
config/kitty/kitty.conf
config/rtx/config.toml
config/mise/config.toml
config/solargraph/config.yml
config/starship.toml
default-gems

View File

@@ -52,7 +52,7 @@ fi
_setup-kubectx-completion() {
local cmd="$1"
local dir="$HOME/.local/share/rtx/installs/kubectx/latest/completion"
local dir="$HOME/.local/share/mise/installs/kubectx/latest/completion"
local target="$ZSH_COMPLETIONS/_${cmd}"
if [ -f "$target" ] || [ ! -d "$dir" ]; then
@@ -74,10 +74,10 @@ _setup-kubectx-completion() {
autoload -U compinit && compinit
}
if command-exists kubectx && ! which _kubectx &> /dev/null; then
if command-exists kubectx; then
_setup-kubectx-completion kubectx
fi
if command-exists kubens && ! which _kubens &> /dev/null; then
if command-exists kubens; then
_setup-kubectx-completion kubens
fi

6
zshenv
View File

@@ -230,9 +230,9 @@ if command-exists sccache; then
export RUSTC_WRAPPER=sccache
fi
# rtx setup
path_prepend "$HOME/.local/share/rtx/bin"
path_prepend "$HOME/.local/share/rtx/shims"
# mise setup
path_prepend "$HOME/.local/share/mise/bin"
path_prepend "$HOME/.local/share/mise/shims"
# orbstack setup
source-if-exists "$HOME/.orbstack/shell/init.zsh"

40
zshrc
View File

@@ -91,25 +91,31 @@ if command-exists direnv; then
eval "$(direnv hook zsh)"
fi
RTX_HOME="$HOME/.local/share/rtx"
RTX_INIT="$RTX_HOME/shell/init.zsh"
export RTX_INSTALL_PATH="$RTX_HOME/bin/rtx"
MISE_HOME="$HOME/.local/share/mise"
MISE_INIT="$MISE_HOME/shell/init.zsh"
MISE_COMPLETIONS_PATH="${ZSH_COMPLETIONS}/_mise"
export MISE_INSTALL_PATH="$MISE_HOME/bin/mise"
if ! command-exists rtx; then
read -q 'REPLY?rtx is not installed, install with `curl https://rtx.pub/install.sh | sh`? [y/N]:' &&
echo && curl https://rtx.pub/install.sh | sh
if ! command-exists mise; then
read -q 'REPLY?mise is not installed, install with `curl https://mise.jdx.dev/install.sh | sh`? [y/N]:' &&
echo && curl https://mise.jdx.dev/install.sh | sh
fi
if [ -f "$HOME/.local/share/rtx/bin/rtx" ]; then
path_prepend "$RTX_HOME/bin"
fi
if command-exists mise; then
alias mi="mise"
if command-exists rtx; then
if [ ! -f "$RTX_INIT" ] || [ "$RTX_INIT" -ot "$RTX_INSTALL_PATH" ]; then
mkdir -p "$(dirname "$RTX_INIT")"
rtx activate zsh > "$RTX_INIT"
if [ ! -f "$MISE_INIT" ] || [ "$MISE_INIT" -ot "$MISE_INSTALL_PATH" ]; then
mkdir -p "$(dirname "$MISE_INIT")"
mise activate zsh > "$MISE_INIT"
fi
source "$MISE_INIT"
if [ ! -f "$MISE_COMPLETIONS_PATH" ] || [ "$MISE_COMPLETIONS_PATH" -ot "$MISE_INSTALL_PATH" ]; then
echo "Setting up completion for mise -- $MISE_COMPLETIONS_PATH"
mkdir -p "$(dirname "$MISE_COMPLETIONS_PATH")"
mise completions zsh > "$MISE_COMPLETIONS_PATH"
chmod +x "$MISE_COMPLETIONS_PATH"
fi
source "$RTX_INIT"
fi
# ==============================================================================
@@ -117,8 +123,8 @@ fi
# ==============================================================================
if ! command-exists starship; then
read -q 'REPLY?starship is not installed, install with `rtx install starship`? [y/N]:' &&
echo && rtx install starship
read -q 'REPLY?starship is not installed, install with `mise install starship`? [y/N]:' &&
echo && mise install starship
fi
if command-exists starship; then
@@ -131,7 +137,7 @@ if command-exists starship; then
compctl -K _starship starship
else
echo "WARN: starship not found, skipping prompt setup" >&2
echo " install with: rtx install starship" >&2
echo " install with: mise install starship" >&2
fi