♻️ POSIX compliance; install git asap

This commit is contained in:
Marley Rae 2024-01-28 15:32:22 -08:00
parent 7aa9c81c7a
commit 1ede53da1d
9 changed files with 37 additions and 33 deletions

View file

@ -4,3 +4,4 @@ mar does dotfiles
## Sources ## Sources
[oh-my-zsh git](https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Contents/Resources/Documents/index) [oh-my-zsh git](https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Contents/Resources/Documents/index)
[git-prevision](https://gist.github.com/TheCodeArtist/a90978ebca0ff6743036) [git-prevision](https://gist.github.com/TheCodeArtist/a90978ebca0ff6743036)
[iTerm2 keymaps for tmux](https://web.archive.org/web/20230921160724/https://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-for-tmux/)

View file

@ -31,7 +31,7 @@ for file in (string match -r '^.*\/path.fish$' $config_files)
end end
# Load everything else, except completion. # Load everything else, except completion.
for file in (string match -v -r '^.*\/(path|completion)\.fish$' $config_files) for file in (string match -v -r '^.*\/(path|completion|install)\.fish$' $config_files)
source $file source $file
end end

View file

@ -1,7 +1,4 @@
# vim:set ft=toml sw=4 : # vim:set ft=gitconfig :
[alias]
prevision = nevermind =
[color] [color]
diff = always diff = always

6
git/install.fish Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$DOT/homebrew/brew_utils.sh"
brew_install "Github CLI" "gh"
brew_install "Gitmoji" "gitmoji"

View file

@ -1,9 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env sh
# vim:set ft=bash:
cd "$(dirname "${BASH_SOURCE[0]}")" \ . "$DOT/homebrew/brew_utils.sh"
&& . "../homebrew/brew_utils.sh"
brew_install "Git" "git" brew_install "Git" "git"
brew_install "Github CLI" "gh"
brew_install "Gitmoji" "gitmoji"

View file

@ -1,8 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env sh
# vim:set ft=bash:
cd "$(dirname "${BASH_SOURCE[0]}")" \ . "$DOT/script/utils.sh"
&& . "../script/utils.sh"
################################################################################ ################################################################################
# Install # # Install #
@ -10,10 +8,10 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \
install() install()
{ {
if test ! $(which brew); then if test ! "$(which brew)"; then
NONINTERACTIVE=1 \ NONINTERACTIVE=1 \
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \
&> /dev/null >/dev/null 2>&1
print_result $? "Install" print_result $? "Install"
fi fi
@ -25,18 +23,18 @@ install()
add_to_path() add_to_path()
{ {
if command -v brew &> /dev/null; then if command -v brew >/dev/null 2>&1; then
return return
fi fi
HARDWARE="$(uname -m)" HARDWARE="$(uname -m)"
prefix="" prefix=""
if [[ "$(uname)" == "Linux" ]]; then if [ "$(uname)" = "Linux" ]; then
prefix="/home/linuxbrew/.linuxbrew" prefix="/home/linuxbrew/.linuxbrew"
elif [[ "$HARDWARE" == "arm64" ]]; then elif [ "$HARDWARE" = "arm64" ]; then
prefix="/opt/homebrew" prefix="/opt/homebrew"
elif [[ "$HARDWARE" == "x86_64" ]]; then elif [ "$HARDWARE" = "x86_64" ]; then
prefix="/usr/local" prefix="/usr/local"
else else
print_error "Homebrew is only supported on macOS Intel/ARM or Linux!" print_error "Homebrew is only supported on macOS Intel/ARM or Linux!"
@ -44,7 +42,7 @@ add_to_path()
PATH="$prefix/bin:$PATH" PATH="$prefix/bin:$PATH"
command -v brew &> /dev/null command -v brew >/dev/null 2>&1
print_result $? "Add to PATH" print_result $? "Add to PATH"
} }

View file

@ -1,13 +1,12 @@
#!/user/bin/env bash #!/user/bin/env sh
cd "$(dirname "${BASH_SOURCE[0]}")" \ . "$DOT/script/utils.sh"
&& . "../script/utils.sh"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
brew_prefix() brew_prefix()
{ {
local path="" path=""
if path="$(brew --prefix 2>/dev/null)"; then if path="$(brew --prefix 2>/dev/null)"; then
printf "%s" "$path" printf "%s" "$path"
@ -20,7 +19,7 @@ brew_prefix()
brew_tap() brew_tap()
{ {
brew tap "$1" &>/dev/null brew tap "$1" >/dev/null 2>&1
} }
brew_update() brew_update()
@ -37,10 +36,10 @@ brew_upgrade()
brew_install() brew_install()
{ {
declare -r FORMULA_READABLE_NAME="$1" readonly FORMULA_READABLE_NAME="$1"
declare -r FORMULA="$2" readonly FORMULA="$2"
declare -r ARGUMENTS="$3" readonly ARGUMENTS="$3"
declare -r TAP_VALUE="$4" readonly TAP_VALUE="$4"
# Check that Homebrew is installed. # Check that Homebrew is installed.
@ -51,7 +50,7 @@ brew_install()
# If 'brew tap' needs to be executed, check if it executed correctly. # If 'brew tap' needs to be executed, check if it executed correctly.
if [[ -n "$TAP_VALUE" ]]; then if [ -n "$TAP_VALUE" ]; then
if ! brew_tap "$TAP_VALUE"; then if ! brew_tap "$TAP_VALUE"; then
print_error "$FORMULA_READABLE_NAME ('brew tap $TAP_VALUE' failed)" print_error "$FORMULA_READABLE_NAME ('brew tap $TAP_VALUE' failed)"
return 1 return 1
@ -61,7 +60,7 @@ brew_install()
# Install the specified formula. # Install the specified formula.
# shellcheck disable=SC2086 # shellcheck disable=SC2086
if brew list "$FORMULA" &>/dev/null; then if brew list "$FORMULA" >/dev/null 2>&1; then
print_success "$FORMULA_READABLE_NAME" print_success "$FORMULA_READABLE_NAME"
else else
execute "brew install $FORMULA $ARGUMENTS" \ execute "brew install $FORMULA $ARGUMENTS" \

View file

@ -244,6 +244,8 @@ main()
"$DOT/homebrew/brew.sh" "$DOT/homebrew/brew.sh"
"$DOT/git/install.sh"
"$DOT/fish/install.sh" "$DOT/fish/install.sh"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View file

@ -35,6 +35,11 @@ bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind | split-window -h -c "#{pane_current_path}" bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}" bind - split-window -v -c "#{pane_current_path}"
bind-key J resize-pane -D
bind-key K resize-pane -U
bind-key H resize-pane -L
bind-key L resize-pane -R
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Install tpm if not already installed. # Install tpm if not already installed.