mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 00:33: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 "[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
|
||||
if [ command -v appman ]; then
|
||||
|
||||
if command -v appman >/dev/null 2>&1; then
|
||||
appman install wezterm
|
||||
appman install nvim
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ export GUI_SETUP
|
|||
|
||||
if [ "$WHEEL" -eq 1 ]; then
|
||||
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 install -y build-essential
|
||||
elif [ command -v pacman ]; then
|
||||
elif command -v pacman >/dev/null 2>&1; then
|
||||
sudo pacman -Syu --noconfirm
|
||||
sudo pacman -S --noconfirm base-devel
|
||||
else
|
||||
|
|
@ -60,7 +60,7 @@ echo "[INFO] Cloning Dotfiles"
|
|||
|
||||
if [ -d "$DOTFILES" ]; then
|
||||
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
|
||||
else
|
||||
echo "[ERROR] Git is not installed"
|
||||
|
|
@ -92,7 +92,8 @@ source $DOTFILES/tools/bash/profile
|
|||
source $DOTFILES/tools/bash/bashrc
|
||||
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
|
||||
case "$choice" in
|
||||
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
|
||||
# Config relating to the Lazygit UI
|
||||
gui:
|
||||
|
|
@ -79,7 +69,6 @@ gui:
|
|||
- "#cdd6f4"
|
||||
searchingActiveBorderColor:
|
||||
- "#f9e2af"
|
||||
|
||||
authorColors:
|
||||
"*": "#b4befe"
|
||||
# Background color of selected line when view doesn't have focus.
|
||||
|
|
@ -228,7 +217,7 @@ git:
|
|||
disableForcePushing: false
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
||||
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: ""
|
||||
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
|
||||
replace: ""
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ alias ollama="ollama.exe"
|
|||
open() {
|
||||
local target=$1
|
||||
|
||||
if command -v "$FILE_EXPLORER" > /dev/null; then
|
||||
if command -v "$FILE_EXPLORER" >/dev/null 2>&1; then
|
||||
"$FILE_EXPLORER" "$target"
|
||||
else
|
||||
command open "$target"
|
||||
|
|
|
|||
|
|
@ -14,29 +14,29 @@ done
|
|||
|
||||
# Update package managers #
|
||||
# Homebrew, macOS
|
||||
if command -v brew > /dev/null; then
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
brew update
|
||||
brew upgrade
|
||||
fi
|
||||
|
||||
# Arch
|
||||
if command -v pacman > /dev/null; then
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
sudo pacman -Syu
|
||||
fi
|
||||
|
||||
# Debian
|
||||
if command -v apt > /dev/null; then
|
||||
if command -v apt >/dev/null 2>&1; then
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
fi
|
||||
|
||||
# Fedora
|
||||
if command -v dnf > /dev/null; then
|
||||
if command -v dnf >/dev/null 2>&1; then
|
||||
sudo dnf update
|
||||
fi
|
||||
|
||||
# WSL
|
||||
if command -v winget.exe > /dev/null; then
|
||||
if command -v winget.exe >/dev/null 2>&1; then
|
||||
winget.exe upgrade
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ alias g=lazygit
|
|||
|
||||
|
||||
# lsd - modern ls
|
||||
if command -v lsd > /dev/null; then
|
||||
if command -v lsd >/dev/null 2>&1; then
|
||||
alias ls='lsd'
|
||||
alias l='lsd -lah'
|
||||
alias ll='lsd -l'
|
||||
|
|
@ -65,22 +65,22 @@ mtv(){
|
|||
|
||||
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 paci="sudo pacman -S"
|
||||
alias pacr="sudo pacman -R"
|
||||
alias pacu="sudo pacman -Syu"
|
||||
alias pacl="pacman -Q"
|
||||
if command -v paru > /dev/null; then
|
||||
if command -v paru >/dev/null 2>&1; then
|
||||
alias pacs="paru -Ss"
|
||||
elif command -v yay > /dev/null; then
|
||||
elif command -v yay >/dev/null 2>&1; then
|
||||
alias pacs="yay -Ss"
|
||||
else
|
||||
alias pacs="pacman -Ss"
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v apt > /dev/null; then
|
||||
if command -v apt >/dev/null 2>&1; then
|
||||
alias apt="sudo apt"
|
||||
alias apti="sudo apt install"
|
||||
alias aptr="sudo apt remove"
|
||||
|
|
@ -89,7 +89,7 @@ if command -v apt > /dev/null; then
|
|||
alias aptl="apt list --installed"
|
||||
fi
|
||||
|
||||
if command -v brew > /dev/null; then
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
alias brewi="brew install"
|
||||
alias brewr="brew uninstall"
|
||||
alias brewu="brew update && brew upgrade"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ if [ "$(uname)" = "Darwin" ]; then
|
|||
fi
|
||||
|
||||
|
||||
if command -v zoxide > /dev/null ; then
|
||||
if command -v zoxide >/dev/null 2>&1; then
|
||||
eval "$(zoxide init zsh)"
|
||||
# Relative navigation #
|
||||
alias ..="z .."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue