mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
fix(posix-shell): fix on checking command exist
Use `command -v $CMD >/dev/null 2>&1` to check if command exist
This commit is contained in:
parent
8aa9daf582
commit
f3333d2292
7 changed files with 470 additions and 479 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
echo "[INFO] Installing AppMan"
|
echo "[INFO] Installing AppMan"
|
||||||
echo "[ACTION] Type [2] to install AppMan"
|
echo "[ACTION] Type [2] to install AppMan"
|
||||||
wget -q https://raw.githubusercontent.com/ivan-hc/AM/main/AM-INSTALLER && chmod a+x ./AM-INSTALLER && ./AM-INSTALLER
|
wget -q https://raw.githubusercontent.com/ivan-hc/AM/main/AM-INSTALLER && chmod a+x ./AM-INSTALLER && ./AM-INSTALLER
|
||||||
if [ command -v appman ]; then
|
|
||||||
|
if command -v appman >/dev/null 2>&1; then
|
||||||
appman install wezterm
|
appman install wezterm
|
||||||
appman install nvim
|
appman install nvim
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ export GUI_SETUP
|
||||||
|
|
||||||
if [ "$WHEEL" -eq 1 ]; then
|
if [ "$WHEEL" -eq 1 ]; then
|
||||||
echo "[INFO] Installing basic build tools"
|
echo "[INFO] Installing basic build tools"
|
||||||
if [ command -v apt ]; then
|
if command -v apt >/dev/null 2>&1; then
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y build-essential
|
sudo apt install -y build-essential
|
||||||
elif [ command -v pacman ]; then
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
sudo pacman -Syu --noconfirm
|
sudo pacman -Syu --noconfirm
|
||||||
sudo pacman -S --noconfirm base-devel
|
sudo pacman -S --noconfirm base-devel
|
||||||
else
|
else
|
||||||
|
|
@ -60,7 +60,7 @@ echo "[INFO] Cloning Dotfiles"
|
||||||
|
|
||||||
if [ -d "$DOTFILES" ]; then
|
if [ -d "$DOTFILES" ]; then
|
||||||
echo "[INFO] Dotfiles already cloned"
|
echo "[INFO] Dotfiles already cloned"
|
||||||
elif [ command -v git ]; then
|
elif command -v git >/dev/null 2>&1; then
|
||||||
git clone https://github.com/js0ny/dotfiles.git "$DOTFILES" --depth 1
|
git clone https://github.com/js0ny/dotfiles.git "$DOTFILES" --depth 1
|
||||||
else
|
else
|
||||||
echo "[ERROR] Git is not installed"
|
echo "[ERROR] Git is not installed"
|
||||||
|
|
@ -92,7 +92,8 @@ source $DOTFILES/tools/bash/profile
|
||||||
source $DOTFILES/tools/bash/bashrc
|
source $DOTFILES/tools/bash/bashrc
|
||||||
source $DOTFILES/tools/bash/bash_aliases
|
source $DOTFILES/tools/bash/bash_aliases
|
||||||
|
|
||||||
if [ command -v zsh ]; then
|
if command -v zsh >/dev/null 2>&1; then
|
||||||
|
|
||||||
read -p "[ACTION] Do you want to setup zsh? (Y/n) " choice
|
read -p "[ACTION] Do you want to setup zsh? (Y/n) " choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
n|N)
|
n|N)
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,3 @@
|
||||||
# $DOTFILES/common/lazygit.yaml
|
|
||||||
# Date: 2024-12-22
|
|
||||||
# Author: js0ny
|
|
||||||
|
|
||||||
# Location:
|
|
||||||
# *nix: ~/.config/lazygit/config.yml
|
|
||||||
# Windows: %APPDATA%\lazygit\config.yml
|
|
||||||
# Linking:
|
|
||||||
# ln -sf ~/.dotfiles/common/lazygit.yaml ~/.config/lazygit/config.yml
|
|
||||||
|
|
||||||
yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json
|
yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json
|
||||||
# Config relating to the Lazygit UI
|
# Config relating to the Lazygit UI
|
||||||
gui:
|
gui:
|
||||||
|
|
@ -79,7 +69,6 @@ gui:
|
||||||
- "#cdd6f4"
|
- "#cdd6f4"
|
||||||
searchingActiveBorderColor:
|
searchingActiveBorderColor:
|
||||||
- "#f9e2af"
|
- "#f9e2af"
|
||||||
|
|
||||||
authorColors:
|
authorColors:
|
||||||
"*": "#b4befe"
|
"*": "#b4befe"
|
||||||
# Background color of selected line when view doesn't have focus.
|
# Background color of selected line when view doesn't have focus.
|
||||||
|
|
@ -228,7 +217,7 @@ git:
|
||||||
disableForcePushing: false
|
disableForcePushing: false
|
||||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
||||||
commitPrefix:
|
commitPrefix:
|
||||||
# pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
|
- # pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
|
||||||
pattern: ""
|
pattern: ""
|
||||||
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
|
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
|
||||||
replace: ""
|
replace: ""
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ alias ollama="ollama.exe"
|
||||||
open() {
|
open() {
|
||||||
local target=$1
|
local target=$1
|
||||||
|
|
||||||
if command -v "$FILE_EXPLORER" > /dev/null; then
|
if command -v "$FILE_EXPLORER" >/dev/null 2>&1; then
|
||||||
"$FILE_EXPLORER" "$target"
|
"$FILE_EXPLORER" "$target"
|
||||||
else
|
else
|
||||||
command open "$target"
|
command open "$target"
|
||||||
|
|
|
||||||
|
|
@ -14,29 +14,29 @@ done
|
||||||
|
|
||||||
# Update package managers #
|
# Update package managers #
|
||||||
# Homebrew, macOS
|
# Homebrew, macOS
|
||||||
if command -v brew > /dev/null; then
|
if command -v brew >/dev/null 2>&1; then
|
||||||
brew update
|
brew update
|
||||||
brew upgrade
|
brew upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Arch
|
# Arch
|
||||||
if command -v pacman > /dev/null; then
|
if command -v pacman >/dev/null 2>&1; then
|
||||||
sudo pacman -Syu
|
sudo pacman -Syu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Debian
|
# Debian
|
||||||
if command -v apt > /dev/null; then
|
if command -v apt >/dev/null 2>&1; then
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt upgrade
|
sudo apt upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fedora
|
# Fedora
|
||||||
if command -v dnf > /dev/null; then
|
if command -v dnf >/dev/null 2>&1; then
|
||||||
sudo dnf update
|
sudo dnf update
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# WSL
|
# WSL
|
||||||
if command -v winget.exe > /dev/null; then
|
if command -v winget.exe >/dev/null 2>&1; then
|
||||||
winget.exe upgrade
|
winget.exe upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ alias g=lazygit
|
||||||
|
|
||||||
|
|
||||||
# lsd - modern ls
|
# lsd - modern ls
|
||||||
if command -v lsd > /dev/null; then
|
if command -v lsd >/dev/null 2>&1; then
|
||||||
alias ls='lsd'
|
alias ls='lsd'
|
||||||
alias l='lsd -lah'
|
alias l='lsd -lah'
|
||||||
alias ll='lsd -l'
|
alias ll='lsd -l'
|
||||||
|
|
@ -65,22 +65,22 @@ mtv(){
|
||||||
|
|
||||||
alias update="source $DOTFILES/scripts/update.zsh"
|
alias update="source $DOTFILES/scripts/update.zsh"
|
||||||
|
|
||||||
if command -v pacman > /dev/null; then
|
if command -v pacman >/dev/null 2>&1; then
|
||||||
alias pac="sudo pacman"
|
alias pac="sudo pacman"
|
||||||
alias paci="sudo pacman -S"
|
alias paci="sudo pacman -S"
|
||||||
alias pacr="sudo pacman -R"
|
alias pacr="sudo pacman -R"
|
||||||
alias pacu="sudo pacman -Syu"
|
alias pacu="sudo pacman -Syu"
|
||||||
alias pacl="pacman -Q"
|
alias pacl="pacman -Q"
|
||||||
if command -v paru > /dev/null; then
|
if command -v paru >/dev/null 2>&1; then
|
||||||
alias pacs="paru -Ss"
|
alias pacs="paru -Ss"
|
||||||
elif command -v yay > /dev/null; then
|
elif command -v yay >/dev/null 2>&1; then
|
||||||
alias pacs="yay -Ss"
|
alias pacs="yay -Ss"
|
||||||
else
|
else
|
||||||
alias pacs="pacman -Ss"
|
alias pacs="pacman -Ss"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v apt > /dev/null; then
|
if command -v apt >/dev/null 2>&1; then
|
||||||
alias apt="sudo apt"
|
alias apt="sudo apt"
|
||||||
alias apti="sudo apt install"
|
alias apti="sudo apt install"
|
||||||
alias aptr="sudo apt remove"
|
alias aptr="sudo apt remove"
|
||||||
|
|
@ -89,7 +89,7 @@ if command -v apt > /dev/null; then
|
||||||
alias aptl="apt list --installed"
|
alias aptl="apt list --installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v brew > /dev/null; then
|
if command -v brew >/dev/null 2>&1; then
|
||||||
alias brewi="brew install"
|
alias brewi="brew install"
|
||||||
alias brewr="brew uninstall"
|
alias brewr="brew uninstall"
|
||||||
alias brewu="brew update && brew upgrade"
|
alias brewu="brew update && brew upgrade"
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ if [ "$(uname)" = "Darwin" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if command -v zoxide > /dev/null ; then
|
if command -v zoxide >/dev/null 2>&1; then
|
||||||
eval "$(zoxide init zsh)"
|
eval "$(zoxide init zsh)"
|
||||||
# Relative navigation #
|
# Relative navigation #
|
||||||
alias ..="z .."
|
alias ..="z .."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue