Merge pull request #50 from andrejusk/zsh

Zsh
This commit is contained in:
2025-06-03 00:13:00 +01:00
committed by GitHub
33 changed files with 250 additions and 1906 deletions

View File

@@ -4,15 +4,16 @@
FROM debian:bookworm-slim AS base
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get -qq update
RUN apt-get -qq install --no-install-recommends \
bc \
curl \
gnupg \
gnupg2 \
lsb-release \
openssh-client \
software-properties-common \
lsb-release \
sudo \
wget
@@ -41,9 +42,9 @@ WORKDIR "$DOTFILES_DIR"
FROM source AS install
ENV USER="test-user"
ENV SKIP_SUDO_CHECK "true"
ENV SKIP_SSH_CONFIG "true"
ENV SKIP_DOCKER_CONFIG "true"
ENV SKIP_SUDO_CHECK="true"
ENV SKIP_SSH_CONFIG="true"
ENV SKIP_DOCKER_CONFIG="true"
USER test-user
ARG UUID="docker"

View File

@@ -1,11 +1,5 @@
# dotfiles
alias dots=$DOTFILES/install
# jump around
alias j="z"
# zip
alias tarz="tar -czvf"
# unzip
alias tarx="tar -xzvf"
alias taru="tarx"
alias bench='ZSH_BENCH=1 exec zsh'
alias dots='cd $DOTFILES'
alias j='z'
alias reload='source ~/.zshrc'
alias zen='curl -s https://api.github.com/zen && echo'

File diff suppressed because it is too large Load Diff

View File

@@ -1,100 +1,75 @@
# U _____ u _ _ __ __
# \| ___"|/| \ |"| \ \ /"/u
# | _|" <| \| |> \ \ / //
# | |___ U| |\ |u /\ V /_,-.
# |_____| |_| \_| U \_/-(_/
# << >> || \\,-.//
# (__) (__)(_") (_/(__)
#
# xdg data & config
# -----------------------------------------------------------------
export XDG_DATA_HOME=${XDG_DATA_HOME:-"$HOME/.local/share"}
mkdir -p "$XDG_DATA_HOME"
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"}
mkdir -p "$XDG_CONFIG_HOME"
# local user binaries
local_bin_path="$HOME/.local/bin"
if [[ ":$PATH:" != *":$local_bin_path:"* ]]; then
export PATH="$local_bin_path:$PATH"
# -----------------------------------------------------------------
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
mkdir -p ~/.local/bin
unset local_bin_path
# homebrew
brew_path="/opt/homebrew/bin/brew"
if [ -x "$brew_path" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
unset brew_path
mkdir -p $HOME/.local/bin
# workspace
# -----------------------------------------------------------------
export WORKSPACE=${WORKSPACE:-"$HOME/Workspace"}
mkdir -p "$WORKSPACE"
# dotfiles
# -----------------------------------------------------------------
export DOTFILES=${DOTFILES:-"$HOME/.dotfiles"}
# nvm
# Initialise and load Node
# -----------------------------------------------------------------
if [ -z "$NVM_DIR" ]; then
export NVM_DIR=${NVM_DIR:-"$HOME/.nvm"}
mkdir -p "$NVM_DIR"
fi
[ -f "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
# node (default v20 "iron" LTS version)
node_alias="$NVM_DIR/alias/lts/iron"
_dots_load_nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
}
_dots_load_nvm
node_alias="$NVM_DIR/alias/lts/jod"
if [ -f "$node_alias" ]; then
VERSION=`cat $node_alias`
if [ -x `command -v nvm` ]; then
nvm install "$VERSION" > /dev/null 2>&1 & disown
fi
node_bin_path="$NVM_DIR/versions/node/$VERSION/bin"
if [[ ":$PATH:" != *":$node_bin_path:"* ]]; then
export PATH="$node_bin_path:$PATH"
fi
fi
unset node_alias node_bin_path VERSION
unset node_alias VERSION node_bin_path
# pyenv
# Initialise and load Python
# -----------------------------------------------------------------
export PYENV_ROOT=${PYENV_ROOT:-"$HOME/.pyenv"}
pyenv_bin_path="$PYENV_ROOT/bin"
if [[ ":$PATH:" != *":$pyenv_bin_path:"* ]]; then
export PATH="$pyenv_bin_path:$PATH"
if [[ ":$PATH:" != *":$PYENV_ROOT/bin:"* ]]; then
export PATH="$PYENV_ROOT/bin:$PATH"
fi
if [ -x `command -v pyenv` ]; then
eval "$(pyenv init --path)"
fi
unset pyenv_bin_path
_dots_load_pyenv() {
[ -x `command -v pyenv` ] && eval "$(pyenv init --path)"
}
_dots_load_pyenv
# poetry
export POETRY_ROOT=${POETRY_ROOT:-"$HOME/.poetry"}
poetry_bin_path="$POETRY_ROOT/bin"
if [[ ":$PATH:" != *":$poetry_bin_path:"* ]]; then
export PATH="$poetry_bin_path:$PATH"
fi
unset poetry_bin_path
# z (jump around)
export Z_DATA_DIR=${Z_DATA:-"$XDG_DATA_HOME/z"}
export Z_DATA=${Z_DATA:-"$Z_DATA_DIR/data"}
export Z_OWNER=${Z_OWNER:-$USER}
# nix
if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
. $HOME/.nix-profile/etc/profile.d/nix.sh
if [[ ":$PATH:" != *":$POETRY_ROOT/bin:"* ]]; then
export PATH="$POETRY_ROOT/bin:$PATH"
fi
# _ _ _ ____
# U /"\ u |"| ___ U /"\ u / __"| u
# \/ _ \/ U | | u |_"_| \/ _ \/ <\___ \/
# / ___ \ \| |/__ | | / ___ \ u___) |
# /_/ \_\ |_____| U/| |\u /_/ \_\ |____/>>
# \\ >> // \\.-,_|___|_,-.\\ >> )( (__)
# (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__)
#
# aliases
# -----------------------------------------------------------------
if [ -f ~/.aliases ]; then
source ~/.aliases
fi
# Load homebrew
# -----------------------------------------------------------------------------
_dots_load_brew() {
export HOMEBREW_NO_ANALYTICS=0
[ -x "/opt/homebrew/bin/brew" ] && eval "$(/opt/homebrew/bin/brew shellenv)"
}
_dots_load_brew

View File

@@ -1,31 +1,47 @@
# https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#how-do-i-configure-instant-prompt
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
# Prefix all functions with "_dots" for easier profiling
# -----------------------------------------------------------------------------
if [[ -n "$ZSH_BENCH" ]]; then
zmodload zsh/zprof
fi
source $HOME/.profile
# Load profile
# -----------------------------------------------------------------------------
_dots_load_profile() {
source $HOME/.profile
}
_dots_load_profile
export POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
ZSH_THEME="powerlevel10k/powerlevel10k"
# Load oh-my-zsh
# -----------------------------------------------------------------------------
_dots_load_omz() {
export DISABLE_AUTO_UPDATE="true"
export ZSH="$HOME/.oh-my-zsh"
plugins=(
z
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
}
_dots_load_omz
export DISABLE_AUTO_UPDATE="true"
export ZSH="$HOME/.oh-my-zsh"
# Build shell prompt
# -----------------------------------------------------------------------------
_dots_build_prompt() {
local final_prompt=""
# https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
plugins=(
aliases
emoji
git
history
poetry
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
local dir_section="%{$fg_bold[blue]%}%~"
final_prompt+="$dir_section "
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
local prompt_char="%{$reset_color%}%%"
final_prompt+="$prompt_char "
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
PROMPT="$final_prompt"
}
_dots_build_prompt
# Finish bench profiling
# -----------------------------------------------------------------------------
if [[ -n "$ZSH_BENCH" ]]; then
zprof
fi

View File

@@ -5,17 +5,34 @@ set -eo pipefail
# Script to run all install scripts contained in install.d
#
printf "\n\t <<< dots >>>\n"
printf "\t==============\n\n\n"
if [[ -t 1 && -n "$TERM" && "$TERM" != "dumb" ]]; then
CYAN="\033[0;36m"
CYAN_BOLD="\033[1;36m"
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
GREY="\033[1;30m"
NC="\033[0m"
else
RED=""
GREEN=""
YELLOW=""
GREY=""
NC=""
fi
printf "\n\t${CYAN} <<< ${CYAN_BOLD}dots${CYAN} >>> ${NC}\n"
printf "\t${GREY}==============${NC}\n\n"
# Prevent running as root
if [[ $EUID -eq 0 && -z "$SKIP_SUDO_CHECK" ]]; then
echo "Failed: Running as sudo. Please run as user"
echo -e "${RED}Failed: Running as sudo. Please run as user${NC}\n"
exit 1
fi
# Ensure sudo credentials are cached
if [[ -z "$SKIP_SUDO_CHECK" ]]; then
echo -e "${YELLOW}Checking sudo credentials...${NC}"
sudo -v
fi
@@ -44,7 +61,7 @@ else
fi
touch "$log_target"
if [[ ! -f "$log_target" ]]; then
echo "Failed: Unable to create log file \"$log_target\""
echo -e "${RED}Failed: Unable to create log file \"$log_target\"${NC}\n"
exit 1
fi
log_abs_target=$(readlink -f "$log_target")
@@ -54,12 +71,12 @@ targets=($@)
# Run install scripts
run() {
echo "Running \"$(basename "$0")\" at \"$(date)\""
echo "Running as \"$(whoami)\" on \"$(hostname)\""
echo -e "Running \"$(basename "$0")\" at \"$(date)\""
echo -e "Running as \"$(whoami)\" on \"$(hostname)\""
if [[ -n "$targets" ]]; then
echo "Running ${#targets[@]} install target(s): ${targets[@]}"
echo -e "Running ${YELLOW}${#targets[@]}${NC} install target(s): ${YELLOW}${targets[@]}${NC}"
else
echo "Running all install targets"
echo -e "Running all install targets"
fi
for script in $install_dir/*.sh; do
@@ -71,16 +88,33 @@ run() {
fi
fi
script_name=$(basename $script)
printf "\n\n<<< $script_name:\n"
local script_name=$(basename $script)
printf "\n\n${CYAN}<<< ${CYAN_BOLD}$script_name:${NC}\n"
local start_time=$(date +%s.%N)
source $script
printf "\n>>> $script_name\n"
unset script_name
local end_time=$(date +%s.%N)
local execution_time=$(echo "$end_time - $start_time" | bc)
local execution_ms=$(echo "$execution_time * 1000" | bc | awk '{printf "%.0f", $0}')
local execution_ms_formatted=$(printf "%'.0f" "$execution_ms")
local time_color="$GREY"
if (( execution_ms < 2000 )); then
time_color="$GREEN"
elif (( execution_ms < 5000 )); then
time_color="$YELLOW"
else
time_color="$RED"
fi
printf "\n${CYAN}>>> ${CYAN_BOLD}${script_name}, ${NC}"
printf "completed in ${time_color}${execution_ms_formatted}ms${NC}\n"
done
}
echo "install: Logging to \"$log_abs_target\""
echo -e "\ninstall: Logging to \"$log_abs_target\""
total_start_time=$(date +%s.%N)
run 2>&1 | tee "$log_abs_target"
total_end_time=$(date +%s.%N)
# Clean up
unset uuid dir install_dir log_dir log_abs_target log_target
echo "Thank you!"
total_time_raw=$(echo "$total_end_time - $total_start_time" | bc)
total_time=$(echo "$total_time_raw" | awk '{printf "%.3g", $1}')
echo -e "\nThank you!"
echo -e "Total time: ${GREEN}${total_time}s${NC}\n"

View File

@@ -10,5 +10,5 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
cat /etc/os-release
else
echo "Unknown OS: $OSTYPE"
echo -e "${RED}Unknown OS: $OSTYPE${NC}"
fi

View File

@@ -7,6 +7,7 @@
# skip if CODESPACES is set
if [ -n "$CODESPACES" ]; then
echo -e "${YELLOW}Running in a GitHub Codespace${NC}"
export SKIP_SSH_CONFIG=1
fi
@@ -27,4 +28,6 @@ if [ -z "$SKIP_SSH_CONFIG" ]; then
cat $ssh_pub
unset ssh_method ssh_target ssh_key ssh_pub
else
echo -e "${YELLOW}Skipping SSH configuration${NC}"
fi

View File

@@ -6,7 +6,15 @@
#
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ -d "/opt/homebrew/bin" ]; then
export PATH="/opt/homebrew/bin:$PATH"
fi
export NONINTERACTIVE=1
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@@ -14,11 +22,14 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "Homebrew is already installed."
fi
brew update
brew --version
unset NONINTERACTIVE
unset NONINTERACTIVE \
HOMEBREW_NO_ANALYTICS \
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK \
HOMEBREW_NO_ENV_HINTS \
HOMEBREW_NO_AUTO_UPDATE \
HOMEBREW_NO_INSTALL_CLEANUP
else
echo "Skipping: Not macOS"
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -21,5 +21,5 @@ if command -v apt-get &> /dev/null; then
apt --version
else
echo "Skipping: apt-get not found"
echo -e "${YELLOW}Skipping: apt-get not found${NC}"
fi

View File

@@ -22,23 +22,22 @@ if [ ! -d "$ZSH" ]; then
# https://github.com/ohmyzsh/ohmyzsh#unattended-install
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
export ZSH_CUSTOM="$ZSH/custom"
# install zsh-syntax-highlighting
export ZSH_SYNTAX_HIGHLIGHTING="$ZSH/custom/plugins/zsh-syntax-highlighting"
export ZSH_SYNTAX_HIGHLIGHTING="$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
if [ ! -d "$ZSH_SYNTAX_HIGHLIGHTING" ]; then
git clone -q https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_SYNTAX_HIGHLIGHTING
git clone -q \
https://github.com/zsh-users/zsh-syntax-highlighting.git \
$ZSH_SYNTAX_HIGHLIGHTING
fi
# install zsh-autosuggestions
export ZSH_AUTOSUGGESTIONS="$ZSH/custom/plugins/zsh-autosuggestions"
export ZSH_AUTOSUGGESTIONS="$ZSH_CUSTOM/plugins/zsh-autosuggestions"
if [ ! -d "$ZSH_AUTOSUGGESTIONS" ]; then
git clone -q https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_AUTOSUGGESTIONS
fi
# install powerlevel10k
export POWERLEVEL10K="$ZSH/custom/themes/powerlevel10k"
if [ ! -d "$POWERLEVEL10K" ]; then
git clone -q --depth=1 https://github.com/romkatv/powerlevel10k.git $POWERLEVEL10K
git clone -q \
https://github.com/zsh-users/zsh-autosuggestions.git \
$ZSH_AUTOSUGGESTIONS
fi
# change default shell to zsh

View File

@@ -28,6 +28,6 @@ rm -f $HOME/.ssh/config
mkdir -p $HOME/.config
mkdir -p $HOME/.ssh
sudo stow --dir="$root_dir/files" --target="$HOME" home
sudo stow --dir="$root_dir/files" --target="$HOME/.config" dot-config
sudo stow --dir="$root_dir/files" --target="$HOME/.ssh" dot-ssh
stow --dir="$root_dir/files" --target="$HOME" home
stow --dir="$root_dir/files" --target="$HOME/.config" dot-config
stow --dir="$root_dir/files" --target="$HOME/.ssh" dot-ssh

View File

@@ -9,7 +9,7 @@ export PYENV_ROOT="$HOME/.pyenv"
if ! echo $PATH | grep -q "$PYENV_ROOT"; then
export PATH="$PYENV_ROOT/bin:$PATH"
fi
if ! command -v "pyenv" &>/dev/null; then
if ! command -v pyenv &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment
sudo apt-get install -qq build-essential libssl-dev zlib1g-dev \

View File

@@ -7,7 +7,7 @@
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
if ! command -v "python" &>/dev/null; then
if ! command -v python &>/dev/null; then
pyenv install 3.12.1
pyenv global 3.12.1
fi
@@ -38,7 +38,7 @@ fi
mkdir -p ~/.local/bin
unset local_bin_path
if ! command -v "pipx" &>/dev/null; then
if ! command -v pipx &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq pipx
elif [[ "$OSTYPE" == "darwin"* ]]; then
@@ -48,7 +48,7 @@ fi
echo "pipx $(pipx --version)"
if ! command -v "poetry" &>/dev/null; then
if ! command -v poetry &>/dev/null; then
pipx install poetry
fi

View File

@@ -8,16 +8,16 @@
NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
nvm_version="0.39.7"
if ! command -v "nvm" &>/dev/null; then
nvm_version="0.40.3"
if ! command -v nvm &>/dev/null; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh)"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
fi
nvm --version
nvm alias default lts/iron
nvm install lts/iron
nvm use lts/iron
nvm alias default lts/jod
nvm install lts/jod
nvm use lts/jod
echo "Node.js $(node --version)"
@@ -25,9 +25,9 @@ echo "npm $(npm --version)"
npm_dependencies=(
"firebase-tools"
"neovim"
"typescript-language-server"
"typescript"
# "neovim"
# "typescript-language-server"
# "typescript"
)
npm_dependencies=($(comm -13 <(printf "%s\n" "${npm_dependencies[@]}" | sort) <(npm list -g --depth=0 --parseable | awk -F'/' '{print $NF}' | sort)))

View File

@@ -8,6 +8,19 @@
# skip if in WSL
if [[ -n "$WSL_DISTRO_NAME" ]]; then
echo -e "${YELLOW}Running in WSL${NC}"
export SKIP_DOCKER_CONFIG=1
fi
# skip if in CODESPACES
if [[ -n "$CODESPACES" ]]; then
echo -e "${YELLOW}Running in GitHub Codespaces${NC}"
export SKIP_DOCKER_CONFIG=1
fi
# skip on mac
if [[ "$OSTYPE" == "darwin"* ]]; then
echo -e "${YELLOW}Running on macOS${NC}"
export SKIP_DOCKER_CONFIG=1
fi
@@ -43,4 +56,6 @@ if [[ -z "$SKIP_DOCKER_CONFIG" ]]; then
fi
fi
docker --version
else
echo -e "${YELLOW}Skipping Docker configuration${NC}"
fi

View File

@@ -5,13 +5,12 @@
# Install terraform.
#
if ! command -v "terraform" &>/dev/null; then
if ! command -v terraform &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli#install-terraform
wget -O- https://apt.releases.hashicorp.com/gpg |
gpg --dearmor |
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg >/dev/null
terraform_keyring_path="/usr/share/keyrings/hashicorp-archive-keyring.gpg"
if [[ ! -f "$terraform_keyring_path" ]]; then
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o "$terraform_keyring_path"
fi
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" |
sudo tee /etc/apt/sources.list.d/hashicorp.list

View File

@@ -9,4 +9,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
if ! brew list --cask iterm2 &>/dev/null; then
brew install --cask iterm2
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -19,4 +19,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
fi
unset fonts_list
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -5,12 +5,18 @@
# Install Redis.
#
if ! command -v redis-client &>/dev/null; then
if ! command -v redis-cli &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
redis_keyring_path="/usr/share/keyrings/redis-archive-keyring.gpg"
if [[ ! -f "$redis_keyring_path" ]]; then
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o "$redis_keyring_path"
fi
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" \
| sudo tee /etc/apt/sources.list.d/redis.list > /dev/null
sudo apt-get install -qq redis
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install redis
fi
fi
redis-cli --version

View File

@@ -11,4 +11,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "Colour Contrast Analyser (CCA) is already installed."
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -11,4 +11,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "Rectangle is already installed."
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -11,4 +11,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "MeetingBar is already installed."
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -11,4 +11,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "BetterDisplay is already installed."
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -11,4 +11,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "dockutil is already installed."
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -11,4 +11,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "Arc Browser is already installed."
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -12,4 +12,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
echo "AppCleaner is already installed."
fi
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -5,7 +5,7 @@
# Install neofetch.
#
if ! command -v "neofetch" &>/dev/null; then
if ! command -v neofetch &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq neofetch &>/dev/null
elif [[ "$OSTYPE" == "darwin"* ]]; then

View File

@@ -5,15 +5,21 @@
# Install cmatrix.
#
# Check if running in a GitHub Codespace
if [ -n "$CODESPACES" ]; then
echo "Skipping cmatrix installation: Running in a GitHub Codespace"
else
if ! command -v "cmatrix" &>/dev/null; then
# skip if in CODESPACES
if [[ -n "$CODESPACES" ]]; then
echo -e "${YELLOW}Running in GitHub Codespaces${NC}"
export SKIP_CMATRIX_CONFIG=1
fi
if [[ -z "$SKIP_CMATRIX_CONFIG" ]]; then
if ! command -v cmatrix &> /dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq cmatrix &>/dev/null
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install cmatrix
fi
fi
echo -e "${GREEN}cmatrix installed successfully!${NC}"
else
echo -e "${YELLOW}Skipping cmatrix configuration${NC}"
fi

View File

@@ -184,4 +184,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
fi
killall Dock 2>/dev/null || true
else
echo -e "${YELLOW}Skipping: Not macOS${NC}"
fi

View File

@@ -11,3 +11,5 @@ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get autoremove -qq
sudo apt-get clean -qq
fi
echo -e "${GREEN}Cleanup completed successfully!${NC}"

View File

@@ -3,6 +3,7 @@ authors = ["andrejus <hi@andrejus.uk>"]
description = "Verifies dotfiles install"
name = "dotfiles-test"
version = "0.0.1"
package-mode = false
[tool.poetry.dependencies]
python = "^3.9"

View File

@@ -2,7 +2,7 @@
#
# Verifies dotfiles installed binaries correctly
#
from distutils.spawn import find_executable
from shutil import which
from typing import List, Text
from subprocess import run
import pytest
@@ -16,7 +16,7 @@ def in_path(binary: Text) -> bool:
"""
Check whether `binary` is in PATH
"""
return find_executable(binary) is not None
return which(binary) is not None
def in_shell_path(shell: Text, binary: Text) -> bool: