mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-18 22:06:02 +00:00
📝 CodeRabbit Chat: Simplify code
This commit is contained in:
committed by
GitHub
parent
035405b22f
commit
07a7653fe4
103
local/bin/dfm
Executable file → Normal file
103
local/bin/dfm
Executable file → Normal file
@@ -73,21 +73,18 @@ section_install()
|
||||
MENU=(
|
||||
"all:Installs everything in the correct order"
|
||||
"apt-packages:Install apt packages (Debian/Ubuntu)"
|
||||
"cargo:Install rust/cargo packages"
|
||||
"cheat-databases:Install cheat external cheatsheet databases"
|
||||
"composer:Install composer"
|
||||
"dnf-packages:Install dnf packages (Fedora/RHEL)"
|
||||
"fonts:Install programming fonts"
|
||||
"gh:Install GitHub CLI Extensions"
|
||||
"git-crypt:Install git-crypt from source"
|
||||
"go:Install Go Packages"
|
||||
"imagick:Install ImageMagick CLI"
|
||||
"macos:Setup nice macOS defaults"
|
||||
"npm-packages:Install NPM Packages"
|
||||
"mise:Install tools via mise (runtimes + CLI tools)"
|
||||
"mise-cleanup:Remove old version manager installations (--dry-run supported)"
|
||||
"ntfy:Install ntfy notification tool"
|
||||
"nvm-latest:Install latest lts node using nvm"
|
||||
"nvm:Install Node Version Manager (nvm)"
|
||||
"python-packages:Install Python packages via uv"
|
||||
"python-libs:Install Python libraries (libtmux, pynvim)"
|
||||
"shellspec:Install shellspec testing framework"
|
||||
"xcode-cli-tools:Install Xcode CLI tools (macOS)"
|
||||
"z:Install z"
|
||||
@@ -107,13 +104,10 @@ section_install()
|
||||
$0 brew install
|
||||
$0 install fonts
|
||||
|
||||
# Tier 2: Language packages (depend on runtimes from Tier 1)
|
||||
$0 install cargo
|
||||
$0 install go
|
||||
$0 install composer
|
||||
$0 install nvm
|
||||
$0 install npm-packages
|
||||
$0 install python-packages
|
||||
# Tier 2: Runtimes and CLI tools via mise, then remaining installers
|
||||
$0 install mise || exit 1
|
||||
$0 install composer || exit 1
|
||||
$0 install python-libs || exit 1
|
||||
|
||||
# Tier 3: Tool-dependent installers
|
||||
$0 install cheat-databases
|
||||
@@ -131,12 +125,6 @@ section_install()
|
||||
msgr yay "All done!"
|
||||
;;
|
||||
|
||||
cargo)
|
||||
msgr run "Installing cargo packages..."
|
||||
bash "$DOTFILES/scripts/install-cargo-packages.sh" \
|
||||
&& msgr yay "cargo packages installed!"
|
||||
;;
|
||||
|
||||
cheat-databases)
|
||||
msgr run "Installing cheat databases..."
|
||||
for database in "$DOTFILES"/scripts/install-cheat-*.sh; do
|
||||
@@ -163,12 +151,6 @@ section_install()
|
||||
&& msgr yay "github cli extensions installed!"
|
||||
;;
|
||||
|
||||
go)
|
||||
msgr run "Installing Go Packages..."
|
||||
bash "$DOTFILES/scripts/install-go-packages.sh" \
|
||||
&& msgr yay "go packages installed!"
|
||||
;;
|
||||
|
||||
imagick)
|
||||
msgr run "Downloading and installing ImageMagick CLI..."
|
||||
curl -L https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \
|
||||
@@ -182,33 +164,21 @@ section_install()
|
||||
&& msgr yay "macOS defaults set!"
|
||||
;;
|
||||
|
||||
nvm)
|
||||
msgr run "Installing nvm..."
|
||||
local NVM_VERSION
|
||||
NVM_VERSION=$(x-gh-get-latest-version nvm-sh/nvm)
|
||||
msgr ok "Latest nvm version: $NVM_VERSION"
|
||||
local NVM_INSTALL="https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh"
|
||||
local NVM_CURL="curl -o- \"$NVM_INSTALL\" | bash"
|
||||
PROFILE=/dev/null bash -c "$NVM_CURL"
|
||||
$0 install nvm-latest
|
||||
msgr yay "nvm installed!"
|
||||
;;
|
||||
|
||||
nvm-latest)
|
||||
msgr run "Installing latest lts node..."
|
||||
if [ -n "$NVM_DIR" ]; then
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
mise)
|
||||
msgr run "Installing tools via mise..."
|
||||
if ! command -v mise &> /dev/null; then
|
||||
msgr nested "Installing mise..."
|
||||
curl -fsSL https://mise.run | sh || { msgr err "Failed to install mise"; exit 1; }
|
||||
export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH"
|
||||
fi
|
||||
nvm install --lts --latest-npm --default
|
||||
git checkout "$DOTFILES/base/zshrc"
|
||||
git checkout "$DOTFILES/base/bashrc"
|
||||
msgr yay "latest lts node installed!"
|
||||
mise install --yes || { msgr err "mise install failed"; exit 1; }
|
||||
mise reshim || { msgr err "mise reshim failed"; exit 1; }
|
||||
msgr yay "mise tools installed!"
|
||||
;;
|
||||
|
||||
npm-packages)
|
||||
msgr run "NPM Packages install started..."
|
||||
bash "$DOTFILES/scripts/install-npm-packages.sh" \
|
||||
&& msgr yay "NPM Packages have been installed!"
|
||||
mise-cleanup)
|
||||
msgr run "Cleaning up old version manager installations..."
|
||||
bash "$DOTFILES/scripts/cleanup-old-version-managers.sh" "${@:2}"
|
||||
;;
|
||||
|
||||
apt-packages)
|
||||
@@ -235,10 +205,10 @@ section_install()
|
||||
&& msgr yay "ntfy installed!"
|
||||
;;
|
||||
|
||||
python-packages)
|
||||
msgr run "Installing Python packages..."
|
||||
python-libs)
|
||||
msgr run "Installing Python libraries..."
|
||||
bash "$DOTFILES/scripts/install-python-packages.sh" \
|
||||
&& msgr yay "Python packages installed!"
|
||||
&& msgr yay "Python libraries installed!"
|
||||
;;
|
||||
|
||||
xcode-cli-tools)
|
||||
@@ -289,8 +259,11 @@ section_brew()
|
||||
;;
|
||||
|
||||
update)
|
||||
brew update && brew outdated && brew upgrade && brew cleanup
|
||||
msgr yay "Done!"
|
||||
if brew update && brew outdated && brew upgrade && brew cleanup; then
|
||||
msgr yay "Done!"
|
||||
else
|
||||
msgr err "brew update failed"
|
||||
fi
|
||||
;;
|
||||
|
||||
updatebundle)
|
||||
@@ -549,9 +522,9 @@ section_dotfiles()
|
||||
case "$1" in
|
||||
fmt)
|
||||
msgr run "Running all formatters"
|
||||
$0 dotfiles yamlfmt
|
||||
$0 dotfiles shfmt
|
||||
msgr run_done "...done!"
|
||||
$0 dotfiles yamlfmt \
|
||||
&& $0 dotfiles shfmt \
|
||||
&& msgr run_done "...done!"
|
||||
;;
|
||||
|
||||
reset_all)
|
||||
@@ -565,11 +538,11 @@ section_dotfiles()
|
||||
~/.local/share/nvim \
|
||||
~/.local/state/nvim \
|
||||
~/.cache/nvim \
|
||||
~/.config/nvim
|
||||
msgr ok "Deleted old nvim files (share, state and cache + config)"
|
||||
ln -s "$DOTFILES/config/nvim" ~/.config/nvim
|
||||
msgr ok "Linked nvim and astronvim"
|
||||
x-have npm && $0 install npm
|
||||
~/.config/nvim \
|
||||
&& msgr ok "Deleted old nvim files (share, state and cache + config)"
|
||||
ln -s "$DOTFILES/config/nvim" ~/.config/nvim \
|
||||
&& msgr ok "Linked nvim and astronvim"
|
||||
$0 install mise || { msgr err "Failed to install mise tools"; exit 1; }
|
||||
msgr ok "Installed packages"
|
||||
msgr run_done "nvim reset!"
|
||||
;;
|
||||
@@ -593,8 +566,8 @@ section_dotfiles()
|
||||
--language-dialect bash \
|
||||
--func-next-line --list --write \
|
||||
--indent 2 --case-indent --space-redirects \
|
||||
--binary-next-line {} \;
|
||||
msgr yay "dotfiles have been shfmt formatted!"
|
||||
--binary-next-line {} \; \
|
||||
&& msgr yay "dotfiles have been shfmt formatted!"
|
||||
;;
|
||||
|
||||
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||
@@ -740,4 +713,4 @@ main()
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user