Skip to content

Instantly share code, notes, and snippets.

@trajano
Last active April 11, 2024 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trajano/315fecc2986b5ac5f642d207d79303f8 to your computer and use it in GitHub Desktop.
Save trajano/315fecc2986b5ac5f642d207d79303f8 to your computer and use it in GitHub Desktop.
Docker aliases
root = true
[*]
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.py]
indent_size = 4
alias:
- name: up.
value: |
if [ -e "$HOME/.config/bootstrap.sh" ]
then
__fetch_from_onedrive 'https://1drv.ms/u/s!Apdrsccw-Aino9IuCJ70RqooYXs3MQ?e=LqPxLW' > "$HOME/.config/bootstrap.sh"
fi
if [ -e "$HOME/.aliae.yaml" ]
then
__fetch_from_onedrive 'https://1drv.ms/u/s!Apdrsccw-Aino9IjK5XbCSGq2SqVYQ?e=NtQVKu' > "$HOME/.aliae.yaml"
fi
[ -x "$HOME/.local/bin/aliae" ] && curl -s https://aliae.dev/install.sh | bash -s -- -d $HOME/.local/bin
[ -x "$HOME/.local/bin/oh-my-posh" ] && curl -s https://ohmyposh.dev/install.sh | bash -s -- -d $HOME/.local/bin
[ -x "$HOME/.local/bin/docker-cli" ] && curl -sL https://github.com/trajano/docker-cli/releases/download/master/docker-cli_{{.OS}}_{{.Arch}} -o "{{ .Home }}/.local/bin/docker-cli"
[ -x "$HOME/.local/bin/docker-cli.exe" ] && curl -sL https://github.com/trajano/docker-cli/releases/download/master/docker-cli_{{.OS}}_{{.Arch}}.exe -o "{{ .Home }}/.local/bin/docker-cli.exe"
exec {{ .Shell }}
type: function
if: match .Shell "bash" "zsh"
- name: ..
value: pushd .. > /dev/null
if: match .Shell "bash" "zsh"
- name: cd
value: pushd "${1:-$HOME}" > /dev/null
type: function
if: match .Shell "bash" "zsh"
- name: ls
value: ls -FCskh --color=auto
if: and (match .Shell "bash" "zsh") ( not (eq .OS "windows") )
- name: ls
value: ls -FCskh --color=auto --hide=NTUSER.DAT* --hide=ntuser.dat*
if: and (match .Shell "bash" "zsh") (eq .OS "windows")
- name: b
value: |
if [ -x ./build.sh ]
then
./build.sh
elif [ -x ./mvnw ]
then
./mvnw package
elif [ -e ./pom.xml ]
then
mvn package
elif [ -x ./gradlew ]
then
./gradlew build
elif [ -e ./build.gradle ] || [ -e ./build.gradle.kts ]
then
gradle build
else
echo unable to determine build script >&2
return 1
fi
type: function
if: match .Shell "bash" "zsh"
- name: d
value: docker
- name: docker
value: $HOME/.local/bin/docker-cli{{ if eq .OS "windows"}}.exe{{end}}
if: match .Shell "zsh" "bash"
- name: g
value: git
- name: cat
value: |
if [ -t 1 ]
then
command bat "$@"
else
command cat "$@"
fi
type: function
if: match .Shell "bash" "zsh"
- name: baty
value: bat --language=yaml
- name: batj
value: bat --language=json
- name: c1
value: tr -s '[\t\ ]' '\t' | cut -f1
if: match .Shell "zsh" "bash"
- name: c2
value: tr -s '[\t\ ]' '\t' | cut -f2
if: match .Shell "zsh" "bash"
- name: c3
value: tr -s '[\t\ ]' '\t' | cut -f3
if: match .Shell "zsh" "bash"
- name: c4
value: tr -s '[\t\ ]' '\t' | cut -f4
if: match .Shell "zsh" "bash"
- name: curl
value: curl -sSL --fail-with-body
- name: df
value: df -h
- name: du
value: du -h
- name: dpatch
value: |
if [ "$#" -ne 1 ]
then
echo "Usage: dpatch [image name]"
return 1
fi
TT=$1:patch-$RANDOM
git pull
docker build . -t $TT --secret id=init-gradle,src=$HOME/.gradle/init.gradle
docker push $TT
echo $TT
git rev-parse HEAD
type: function
if: match .Shell "bash" "zsh"
- name: kh
value: |
TARGET_HOST=$1
ssh-keygen -R $TARGET_HOST
ssh-keyscan -H $TARGET_HOST >> ~/.ssh/known_hosts
type: function
if: match .Shell "bash" "zsh"
- name: mysql
value: command docker run --log-driver=none --rm -it mysql mysql
- name: redis-cli
value: command docker run --log-driver=none --rm -it redis redis-cli
- name: jq
value: |
if [ -t 1 ] && [ "${#@}" -eq 0 ]
then
command jq -R -C 'fromjson? // .'
else
command jq "$@"
fi
type: function
if: match .Shell "bash" "zsh"
- name: yq
value: |
if [ -t 1 ] && [ "${#@}" -eq 0 ]
then
command yq -C -P
else
command yq "$@"
fi
type: function
if: match .Shell "bash" "zsh"
- name: yyq
x-d: Run through JQ to only extract JSON output before sending to YQ
value: |
command jq -C 'fromjson?'
type: function
if: match .Shell "bash" "zsh"
- name: cp
value: cp -i
if: match .Shell "bash" "zsh"
- name: rm
value: rm -i
if: match .Shell "bash" "zsh"
- name: mv
value: mv -i
if: match .Shell "bash" "zsh"
- name: dsl
value: |
docker service logs "$@" | jq
type: function
if: match .Shell "bash" "zsh"
- name: dir
value: ls -l
if: match .Shell "bash" "zsh"
- name: vi.
value: code ~/OneDrive/gist
- name: code.
value: code ~/OneDrive/gist
- name: __docker_service_lookup
value: |
local result
result=$( command docker service ls --format {{.Name}} | grep "$1" | head -1 )
if [ -n "$result" ]
then
echo "$result"
return 0
else
echo "Service not found: $1" >&2
return 1
fi
type: function
if: match .Shell "bash" "zsh"
- name: sup
value: scoop update '*'
if: eq .OS "windows"
- name: sup
value: brew update && brew upgrade
if: and ( eq .OS "darwin" ) (match .Shell "zsh" "bash" )
- name: __fetch_from_onedrive
value: |
curl -sL 'https://api.onedrive.com/v1.0/shares/u!'$(base64 -b0 <<< "$1" | tr -d '=' | tr '/+' '_-')/driveItem/content
type: function
if: eq .OS "darwin"
- name: __fetch_from_onedrive
value: |
curl -sL 'https://api.onedrive.com/v1.0/shares/u!'$(base64 -w0 <<< "$1" | tr -d '=' | tr '/+' '_-')/driveItem/content
type: function
if: not (eq .OS "darwin")
- name: debug-aliae
value: |
echo "Shell {{ .Shell }}"
echo "OS {{ .OS }}"
echo "Home {{ .Home }}"
echo "Arch {{ .Arch }}"
echo 'match .Shell "bash" "zsh" {{ match .Shell "bash" "zsh" }}'
echo 'match .OS "Darwin" {{ match .OS "Darwin" }}'
aliae init {{ .Shell }} -c "$ALIAE_CONFIG" | cat -n
type: function
- name: omp-theme
value: |
local theme_folder="$HOME/themes"
if (command -v brew > /dev/null)
then
theme_folder=$(brew --prefix oh-my-posh)/themes
fi
local selected_theme
if [ $# -eq 1 ];
then
selected_theme="$theme_folder/$1.omp.json"
else
local themes=("$theme_folder"/*.omp.json)
local theme_count=${#themes[@]}
selected_theme=${themes[RANDOM % theme_count + 1]}
fi
if [ -f "$selected_theme" ];
then
echo "$selected_theme"
if ! (command -v zle-line-init > /dev/null)
then
zle-line-init() {
}
fi
eval "$(oh-my-posh -c "$selected_theme" init {{.Shell}})"
else
echo "Theme file not found: $selected_theme"
fi
type: function
if: and (match .Shell "zsh") (match .OS "darwin" "linux")
- name: omp-theme
value: |
local theme_folder="$HOME/themes"
if (command -v brew > /dev/null)
then
theme_folder=$(brew --prefix oh-my-posh)/themes
fi
local selected_theme
if [ $# -eq 1 ];
then
selected_theme="$theme_folder/$1.omp.json"
else
local themes=("$theme_folder"/*.omp.json)
local theme_count=${#themes[@]}
selected_theme=${themes[RANDOM % theme_count + 1]}
fi
if [ -f "$selected_theme" ]
then
echo "$selected_theme"
eval "$(oh-my-posh -c "$selected_theme" init {{.Shell}})"
else
echo "Theme file not found: $selected_theme"
fi
type: function
if: and (match .Shell "bash") (match .OS "darwin" "linux")
- name: ac
value: "!git add -A && git commit"
type: git
- name: fp
value: fetch --prune
type: git
- name: puf
value: "!git push --force --set-upstream origin $(git rev-parse --abbrev-ref HEAD)"
type: git
- name: lg
value: log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit
type: git
- name: r
value: "!git fp && (GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash origin/HEAD || GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash origin/master)"
type: git
- name: dh
value: diff --name-status origin/HEAD
type: git
- name: ec2
value: |
instance_id=i-01a05b56eab2bcf95
region=us-east-1
if [[ "$1" == "shutdown" ]]; then
aws ec2 stop-instances --instance-ids "$instance_id" --region "$region" > /dev/null
aws ec2 wait instance-stopped --instance-ids "$instance_id" --region "$region" > /dev/null
echo "Instance $instance_id has been stopped."
return
fi
aws ec2 start-instances --instance-ids $instance_id --region us-east-1 > /dev/null
aws ec2 wait instance-running --instance-ids $instance_id --region us-east-1 > /dev/null
instance_ip=$(aws ec2 describe-instances --instance-ids $instance_id --query "Reservations[0].Instances[0].PublicIpAddress" --output text --region us-east-1)
if [[ "$1" == "ip" ]]
then
# If 'ip' parameter is provided, display the IP address and exit
echo "$instance_ip"
return
fi
while ! ssh -o "StrictHostKeyChecking=no" $instance_ip "exit" > /dev/null 2>&1; do
sleep 5
done
echo ssh $instance_ip
ssh $instance_ip
type: function
if: and (match .Shell "bash" "zsh")
# git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# git config --global alias.pu '!git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)'
# git config --global alias.puf '!git push --force --set-upstream origin $(git rev-parse --abbrev-ref HEAD)'
# git config --global alias.fr '!git fp && git pull --rebase origin HEAD'
# git config --global alias.fp 'fetch --prune'
# git config --global alias.ac '!git add -A && git commit'
# git config --global alias.amend 'commit --amend -a --reuse-message=HEAD'
# git config --global alias.remaster 'rebase -i origin/HEAD'
# git config --global alias.rh 'rehead'
# git config --global alias.rehead '!git fetch && git checkout origin/HEAD -b'
env:
- name: OMP_CACHE_DIR
value: '{{ env "XDG_RUNTIME_DIR" }}'
if: not eq( (env "XDG_RUNTIME_DIR") "")
path:
- value: |
{{ .Home }}/.volta/bin
if: match .OS "darwin"
- value: |
{{ .Home }}/.jenv/bin
if: match .OS "darwin"
- value: |
{{ .Home }}/.local/bin
if: match .OS "Linux"
- value: |
/usr/local/bin
if: match .OS "darwin"
script:
- value: |
mkdir -p "$HOME/.local/bin"
if: and (match .Shell "bash" "zsh") (match .OS "darwin" "linux")
- value: |
if ( command -v jenv &> /dev/null )
then
eval "$(jenv init -)"
fi
if: match .Shell "bash" "zsh"
- value: |
bash -c "$(curl -s https://ohmyposh.dev/install.sh)" -- -d "{{ .Home }}/.local/bin"
if: and (match .Shell "bash" "zsh") (match .OS "Darwin" "Linux") (not (hasCommand "oh-my-posh"))
- value: |
if [ -e "{{ .Home }}/OneDrive/gist/my.omp.yml" ]
then
eval "$( oh-my-posh -c '{{ .Home }}/OneDrive/gist/my.omp.yml' init --strict {{ .Shell }} )"
else
eval "$( oh-my-posh -c 'https://gist.githubusercontent.com/trajano/315fecc2986b5ac5f642d207d79303f8/raw/my.omp.yml' init --strict {{ .Shell }} )"
fi
if: match .Shell "bash" "zsh"
# - value: |
# if path "~/OneDrive/gist/my.omp.yml" | path exists {
# oh-my-posh -c '{{ .Home }}/OneDrive/gist/my.omp.yml' init --strict {{ .Shell }} | eval
# } else {
# oh-my-posh -c 'https://gist.githubusercontent.com/trajano/315fecc2986b5ac5f642d207d79303f8/raw/my.omp.yml' init --strict {{ .Shell }} | eval
# }
# if: match .Shell "nu"
# - value: |
# if [ -e "{{ .Home }}/OneDrive/gist/my.omp.yml" ]
# then
# oh-my-posh -c '{{ .Home }}/OneDrive/gist/my.omp.yml' init {{ .Shell }} | source
# else
# oh-my-posh -c 'https://gist.githubusercontent.com/trajano/315fecc2986b5ac5f642d207d79303f8/raw/5b6a905fd426c70d84cbba5713978ddd2a9a9b37/my.omp.yml' init {{ .Shell }} | source
# fi
# if: match .Shell "fish"
- value: |
if (! command -v bat &> /dev/null )
then
curl -sL https://github.com/sharkdp/bat/releases/download/v0.24.0/bat-v0.24.0-i686-unknown-linux-musl.tar.gz | tar zxf - -C "{{ .Home }}/.local/bin" --strip-components=1 --wildcards bat-v0.24.0-i686-unknown-linux-musl/bat
fi
if: and (match .Shell "bash" "zsh") (eq .OS "linux") (match .Arch "i686" "amd64") (not (hasCommand "bat"))
- value: |
curl -sL https://github.com/sharkdp/bat/releases/download/v0.24.0/bat-v0.24.0-arm-unknown-linux-musleabihf.tar.gz | tar zxf - -C "{{ .Home }}/.local/bin" --strip-components=1 --wildcards bat-v0.24.0-arm-unknown-linux-musleabihf/bat
if: and (match .Shell "bash" "zsh") (eq .OS "linux") (eq .Arch "arm64") (not (hasCommand "bat"))
- value: |
curl -sL https://github.com/mikefarah/yq/releases/download/v4.35.2/yq_{{.OS}}_{{.Arch}} -o "{{ .Home }}/.local/bin/yq"
chmod u+x "{{ .Home }}/.local/bin/yq"
if: and (match .Shell "bash" "zsh") (match .OS "linux" "darwin") (not (hasCommand "yq"))
- value: |
if (! command -v bat &> /dev/null )
then
brew install bat
fi
if: and (match .Shell "bash" "zsh") (eq .OS "darwin")
- value: |
if (command -v docker &> /dev/null) && [ ! -x "{{ .Home }}/.local/bin/docker-cli" ]
then
curl -sL https://github.com/trajano/docker-cli/releases/download/master/docker-cli_{{.OS}}_{{.Arch}} -o "{{ .Home }}/.local/bin/docker-cli"
chmod u+x "{{ .Home }}/.local/bin/docker-cli"
fi
if: and (match .Shell "zsh" "bash" ) (match .OS "linux" "darwin")
- value: |
if (command -v docker &> /dev/null ) && [ ! -x "{{ .Home }}/.local/bin/docker-cli.exe" ]
then
curl -sL https://github.com/trajano/docker-cli/releases/download/master/docker-cli_{{.OS}}_{{.Arch}}.exe -o "{{ .Home }}/.local/bin/docker-cli.exe"
fi
if: eq .OS "windows"
- value: |
if [ -e "$HOME/AppData/Local/Android/Sdk" ]
then
export ANDROID_SDK_ROOT="$HOME/AppData/Local/Android/Sdk"
fi
if: eq .OS "windows"
- value: |
if [ -e "$HOME/Library/Android/Sdk" ]
then
export ANDROID_SDK_ROOT="$HOME/Library/Android/Sdk"
fi
if: and (eq .OS "darwin") (match .Shell "zsh" "bash")
- value: |
if [ -e "$HOME/.android/sdk" ]
then
export ANDROID_SDK_ROOT="$HOME/.android/sdk"
fi
if: and (eq .OS "linux") (match .Shell "zsh" "bash")
- value: |
setopt auto_cd
cdpath=($HOME $HOME/p $HOME/Desktop)
if: and (eq .Shell "zsh") (eq .OS "darwin")
- value: |
CDPATH=.:$HOME:/c:/d:/c/dh:/c/p:$HOME/Desktop
if: and (eq .Shell "bash") (eq .OS "windows")
- value: |
stty -ixon
IGNOREEOF=5
HISTCONTROL=ignorespace:ignoredups:erasedups
HISTTIMEFORMAT="🕰️ %m-%d %H:%M ❯ "
shopt -s histappend
if: eq .Shell "bash"
- value: |
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey '^[[1;5H' backward-kill-line
bindkey '^[[1;5F' kill-line
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
autoload -Uz compinit && compinit
if: eq .Shell "zsh"
- value: |
echo "Shell {{ .Shell }}"
echo "oh-my-posh {{ hasCommand "oh-my-posh" }}"
echo "x {{ (match .OS "Darwin" "linux" "windows") }}"
echo "bat {{ hasCommand "bat" }}"
# echo "OS {{ .OS }}"
# echo "Home {{ .Home }}"
# echo "Arch {{ .Arch }}"
# echo 'match .Shell "bash" "zsh" {{ match .Shell "bash" "zsh" }}'
# echo 'match .OS "Darwin" {{ match .OS "Darwin" }}'
#!/bin/bash
# source <( curl -sL 'https://api.onedrive.com/v1.0/shares/u!'$(base64 <<< 'https://1drv.ms/u/s!Apdrsccw-Aino9IuCJ70RqooYXs3MQ?e=LqPxLW' | tr -d '=\n' | tr '/+' '_-')/driveItem/content )
if [ ! -e "$HOME/OneDrive/gist/bootstrap.sh" ] && [ ! -e "$HOME/.config/bootstrap.sh" ] && [ ! -e $HOME/Library/CloudStorage/OneDrive-Personal/gist/bootstrap.sh ]
then
mkdir -p $HOME/.config
curl -sL -o $HOME/.config/bootstrap.sh 'https://api.onedrive.com/v1.0/shares/u!'$(base64 <<< 'https://1drv.ms/u/s!Apdrsccw-Aino9IuCJ70RqooYXs3MQ?e=LqPxLW' | tr -d '=\n' | tr '/+' '_-')/driveItem/content
if [ "$ZSH_VERSION" ]
then
echo source "\$HOME/.config/bootstrap.sh" >> $HOME/.zshrc
elif [ "$BASH_VERSION" ]
then
echo source "\$HOME/.config/bootstrap.sh" >> $HOME/.bashrc
fi
fi
if [ -x "$HOME/.local/bin" ]
then
export PATH=$HOME/.local/bin:$PATH
fi
if (! command -v aliae &> /dev/null )
then
mkdir -p $HOME/.local/bin
curl -s https://aliae.dev/install.sh | bash -s -- -d $HOME/.local/bin
export PATH=$HOME/.local/bin:$PATH
fi
ALIAE_CONFIG="$HOME/OneDrive/gist/aliae.yml"
[ -e $ALIAE_CONFIG ] || ALIAE_CONFIG="$HOME/.aliae.yaml"
[ -e $ALIAE_CONFIG ] || ALIAE_CONFIG="$HOME/Library/CloudStorage/OneDrive-Personal/gist/aliae.yml"
[ -e $ALIAE_CONFIG ] || ALIAE_CONFIG="https://gist.githubusercontent.com/trajano/315fecc2986b5ac5f642d207d79303f8/raw/aliae.yml"
eval "$( aliae init $( aliae get shell ) -c $ALIAE_CONFIG )"
_docker_service_lookup() {
command docker service ls --format {{.Name}} | grep $1 | head -1
}
dsl() {
if [[ "$1" == "" ]]
then
docker service ls
elif [[ "$2" != "" ]]
then
local SERVICE=$(_docker_service_lookup $2)
echo -ne "\033]0;📜 $SERVICE \a" < /dev/null
docker service logs --since=$1 -f --raw $SERVICE
else
local SERVICE=$(_docker_service_lookup $1)
echo -ne "\033]0;📜 $SERVICE \a" < /dev/null
docker service logs --tail=0 -f --raw $SERVICE
fi
}
dsl0() {
local SERVICE=$(_docker_service_lookup $1)
echo -ne "\033]0;📜 $SERVICE \a" < /dev/null
docker service logs -f --raw $SERVICE
}
#!/usr/bin/env python3
# This wraps the actual docker command
import sys
import subprocess
import argparse
from abc import ABC, abstractmethod
import logging
class Command(ABC):
def __init__(self, receiver):
self.receiver = receiver
def process(self):
pass
def service_command_group():
service_parser = argparse.ArgumentParser(
description="Wrapped Docker CLI", exit_on_error=False
)
service_parser.add_argument("service")
service_parser.add_argument("command")
[namespace, parsed] = service_parser.parse_known_args()
print(vars(namespace))
return False
def run_docker_command(*args):
docker_command = ["docker"] + list(args)
completed_process = subprocess.run(docker_command)
sys.exit(completed_process.returncode)
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
args = sys.argv[1:]
parser = argparse.ArgumentParser(
description="Wrapped Docker CLI", exit_on_error=False
)
parser.add_argument("command")
try:
[namespace, parsed] = parser.parse_known_args()
# logging.debug("namespace %s parsed %s", namespace, parsed)
if namespace.command == "service" and service_command_group():
pass
elif namespace.command == "ps":
run_docker_command(
"ps",
"--format",
r"table {{.Names}}\t{{.Image}}\t{{.Status}}",
*parsed
)
else:
run_docker_command(*args)
except argparse.ArgumentError as e:
logging.warning("namespace %s", e)
print(e.args)
docker() {
ARGS=("$@")
# set -x
if [ "$*" == 'ps' ]
then
command docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Status}}"
elif [ "$*" == 'h' ]
then
cat <<EOT
docker service image [image] [service]
docker service restart [service]
docker service restart down
docker service rescale [service]
docker service ps down
docker ptag [local] [remote]
EOT
elif [ "$*" == 'service ls' ]
then
command docker service ls --format "table {{.Name}}\t{{.Image}}\t{{.Replicas}}\t{{.Ports}}"
elif [ "$*" == 'service ps' ]
then
for service in $(command docker service ls --format "{{.Name}}")
do
command docker service ps --format "table {{ .Name | printf \"%-40.40s\" }}\t{{ .Image | printf \"%-40.40s\" }}\t{{ .Node | printf \"%-20.20s\" }}\t{{.CurrentState | printf \"%-30.30s\" }}\t{{.Error}}" $service | egrep -v "^NAME" | grep -v '\\_'
done
elif [ "$*" == 'service psa' ]
then
for service in $(command docker service ls --format "{{.Name}}")
do
command docker service ps --format "table {{ .Name | printf \"%-40.40s\" }}\t{{ .Image | printf \"%-40.40s\" }}\t{{ .Node | printf \"%-20.20s\" }}\t{{.CurrentState | printf \"%-30.30s\" }}\t{{.Error}}" $service
done
elif [ "$*" == 'stats' ]
then
local watcher=$( which viddy 2>/dev/null || which watch 2>/dev/null)
if [ "$watcher" ]
then
"$watcher" docker stats --no-stream --format "'table{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'"
else
command docker stats --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'
fi
elif [ "$*" == 'stat' ]
then
command docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'
elif [ "$*" == 'nostat' ]
then
diff --unchanged-line-format="" <(cat <(command docker stats --no-stream --format '{{.Name}}') <(command docker stats --no-stream --format '{{.Name}}') | sort | uniq) <(command docker ps --format '{{.Names}}' | sort)
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'restart' -a "${ARGS[2]}" == 'down' ]
then
for service in $(command docker service ls --format "table {{.Name}} {{.Replicas}}" | grep ' 0/' | grep -v '0/0' | awk '{ print $1 }')
do
command docker service update --force -d $service
done
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'ps' -a "${ARGS[2]}" == 'down' ]
then
for service in $(command docker service ls --format "table {{.Name}} {{.Replicas}}" | grep ' 0/' | grep -v '0/0' | awk '{ print $1 }')
do
command docker service ps --no-trunc --format "table {{.Name}}\t{{.Image}}\t{{.Node}}\t{{.CurrentState}}\t{{.Error}}" $service
done
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'ps' ]
then
command docker service ps --no-trunc --format "table {{.Name}}\t{{.Image}}\t{{.Node}}\t{{.CurrentState}}\t{{.Error}}" ${ARGS[@]:2}
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'restart' ]
then
for service in ${ARGS[@]:2}
do
command docker service update --force $(_docker_service_lookup $service)
done
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'rm' -a "${ARGS[2]}" == 'down' ]
then
command docker service rm $(command docker service ls --format "table {{.Name}} {{.Replicas}}" | grep ' 0/' | grep -v '0/0' | awk '{ print $1 }')
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'info' ]
then
for service in ${ARGS[@]:2}
do
command docker service inspect $service | jq .[0].Spec
done
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'rescale' ]
then
for service in ${ARGS[@]:2}
do
command docker service scale $service=0
command docker service scale $service=1
done
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'ls' -a "${ARGS[2]}" == 'down' ]
then
command docker service ls --format "table {{.Name}}\t{{.Image}}\t{{.Replicas}}\t{{.Ports}}" | grep ' 0/' | grep -v '0/0'
elif [ "${ARGS[0]}" == 'service' -a "${ARGS[1]}" == 'image' ]
then
command docker service update --image "${ARGS[2]}" --with-registry-auth "${ARGS[3]}"
elif [ "${ARGS[0]}" == 'ptag' ]
then
command docker tag ${ARGS[@]:1}
while ! ( command docker push ${ARGS[@]:2} )
do
sleep 1
done
elif [ "${ARGS[0]}" == 'volume' -a "${ARGS[1]}" == 'files' ]
then
command docker run --rm -v ${ARGS[2]}:/mnt alpine //bin/sh -c "find /mnt -print | sed 's/^\/mnt//'"
elif [ "${ARGS[0]}" == 'volume' -a "${ARGS[1]}" == 'cp' ]
then
local C=$( command docker run -d -v ${ARGS[2]}:/mnt alpine )
command docker cp $C:/mnt${ARGS[3]} ${ARGS[4]}
command docker rm -f $C > /dev/null
elif [ "${ARGS[0]}" == 'node' -a "${ARGS[1]}" == 'ps' ]
then
command docker node ps --format "table {{.Name}}\t{{.Image}}\t{{.DesiredState}}\t{{.CurrentState}}\t{{.Error}}" --filter='desired-state=Running' ${ARGS[@]:2}
elif [ "${ARGS[0]}" == 'node' -a "${ARGS[1]}" == 'activate' ]
then
command docker node update --availability=active ${ARGS[@]:2}
elif [ "${ARGS[0]}" == 'node' -a "${ARGS[1]}" == 'pause' ]
then
command docker node update --availability=pause ${ARGS[@]:2}
elif [ "${ARGS[0]}" == 's' ]
then
command docker service ${ARGS[@]:1}
else
command docker "$@"
fi
# set +x
}
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
version: 2.0
# Don't use Material glyphs if possible because it causes issues on VSCode
# https://github.com/microsoft/vscode/issues/191379
# Also avoid Emojis because some of the higher range ones won't render correctly on Visual Studio Code
palettes:
template: "pastel"
list:
pastel:
# Idea is to have dark element text with more pastel background
error: "#ff5f5f"
os_icon: "#f5cead"
os_background: "#6a1ce3"
shell_root: "88"
text: "#101010"
# Path is yellow on blue (it will always be this because that's how I like it)
path_text: "#ffe14c"
path: "#001070"
# Git theme would be teal because I just feel like it :)
git_text: "#003030"
git_logo: "#FF5000"
git_repo: "#577DC8" #005f5f
git: "#07beb8" #005f5f
git_sha: "#57cc99" #005f5f
git_detached: "160" #005f5f
# Who am I violet unless I am root.
session: "#cf00cf"
session_root: "#c41a4e"
# Docker context violet
docker_context: "#a00060"
# docker_context: "146"
# Battery orange
# Low and discharging
battery_critical: "160"
# Low and charging
battery_low: "166"
battery_halfway: "172"
regular: "18" #000087
prompt: "#ffe14c"
prompt_transient: "243"
prompt_transient_clock: "103" ##8787af
tool_version: "63"
package_version: "66"
package_text: "222"
status_code: "184"
jobs: "93"
jobs_count: "220"
not_me: "230"
dark:
# Idea is to have dark element text with more pastel background? NAH
# https://www.ditig.com/256-colors-cheat-sheet
# avoid 0-15 because they get remapped by the Terminal.
error: "166"
os_icon: "230"
os_background: "19"
shell_root: "88"
text: "#C0C0C0"
# Path is yellow on blue
path_text: "#ffe14c"
path: "#001070"
# Git theme would be teal because I just feel like it :)
git_text: "#C0C070"
git_logo: "#FF5000"
git_repo: "#1c2541" #005f5f
git: "#005050" #005f5f
git_sha: "#006060" #005f5f
git_detached: "160" #005f5f
# Who am I violet unless I am root.
session: "#800080"
session_root: "#c41a4e"
# Docker context violet
docker_context: "#a00060"
# docker_context: "146"
# Battery orange
# Low and discharging
battery_critical: "160"
# Low and charging
battery_low: "166"
battery_halfway: "172"
regular: "18" #000087
prompt: "#ffe14c"
prompt_transient: "243"
prompt_transient_clock: "103" ##8787af
tool_version: "63"
package_version: "66"
package_text: "222"
status_code: "184"
jobs: "93"
jobs_count: "220"
not_me: "230"
ansi256:
# https://www.ditig.com/256-colors-cheat-sheet
# avoid 0-15 because they get remapped by the Terminal.
error: "166"
os_icon: "230"
os_background: "19"
shell_root: "88"
text: "250"
# Path is yellow on blue
path_text: "227"
path: "21"
# Git theme would be teal because I just feel like it :)
git_text: "252"
git_logo: "196"
git_repo: "53" #005f5f
git: "23" #005f5f
git_sha: "30" #005f5f
git_detached: "160" #005f5f
# Who am I violet unless I am root.
session: "90"
session_root: "160"
# Docker context violet
docker_context: "90"
# docker_context: "146"
# Battery orange
# Low and discharging
battery_critical: "160"
# Low and charging
battery_low: "166"
battery_halfway: "172"
regular: "18" #000087
prompt: "226"
prompt_transient: "243"
tool_version: "63"
package_version: "66"
package_text: "222"
status_code: "184"
jobs: "93"
jobs_count: "220"
not_me: "230"
var:
ShowLocal: false
blocks:
- type: prompt
alignment: left
segments:
# https://ohmyposh.dev/docs/segments/os
# This is actually a hack, I wanted to have a rounded element for whatever the first active one would
# be, but I haven't figured it out yet. So I am using the OS icon for now as a permanent fixture
- type: shell
style: diamond
leading_diamond: ""
#trailing_diamond: ""
foreground: "p:os_icon"
background_templates:
- "{{ if .Root }}p:shell_root{{end}}"
- "p:os_background"
template: "{{ .Name }} "
properties:
mapped_shell_names:
pwsh: "\uebc7"
bash: "\uebca"
zsh: "\uf179"
# pwsh: 󰨊
#bash: "#️⃣"
# bash: "󱆃"
# bash: "#!"
#pwsh: "PS"
# 
#fish: 󰈺
fish: 🐟
#zsh: 💤
#zsh: 󰬡
- type: session
style: powerline
#powerline_symbol: "{{.Var.PowerLineSymbolL}}"
# powerline_symbol: ""
powerline_symbol: 
foreground: "p:text"
background_templates:
- "{{ if .Root }}p:session_root{{end}}"
- "p:session"
templates:
- " {{ if .SSHSession }}󰢹 {{ .UserName }}  {{ .HostName }}{{ end }} "
- " {{ if .Var.ShowLocal }} {{ .UserName }}  {{ .HostName }}{{ end }} "
templates_logic: first_match
- type: text
alias: gitRepoText
style: powerline
#powerline_symbol: "{{.Var.PowerLineSymbolL}}"
powerline_symbol: ""
foreground: "p:git_text"
background: "p:git_repo"
# template: " <p:git_logo>\ue702</> {{.RepoName}} "
template: " {{if .Segments.Contains \"theGit\"}}<p:git_logo>\ue702</> {{.Segments.theGit.RepoName}} {{end}}"
# template: "{{if and (ne .Segments.theGit.Dir .PWD) ( .Segments.theGit)}} \ue702 {{.Segments.theGit.RepoName}} {{end}}"
- type: path
# style: diamond
style: powerline
# powerline_symbol: ""
powerline_symbol: ""
properties:
style: mixed
folder_separator_icon: /
home_icon: 🏠
mapped_locations:
"C:/p": 
"C:/": "💾 C:"
"D:/": "💾 D:"
"E:/": "💾 E:"
"C:/dh": 💡
# Hack for git bash
"C:/Program Files/Git": /
# "~/Desktop": 󱈹
"~/OneDrive": "\uf0c2"
# "~/OneDrive": ☁️
"~/Downloads": 󰇚
#"~/p": 
"~/p": 💡
# leading_diamond: ""
# leading_diamond: ""
foreground: "p:path_text"
background: "p:path"
template: " {{if .Segments.Contains \"theGit\" }}{{ .PWD | replace .Segments.theGit.Dir \"\" | replace \"\\\\\" \"/\"}}{{else}}{{ .Path }}{{end}} "
- type: text
style: powerline
#powerline_symbol: "{{.Var.PowerLineSymbolL}}"
powerline_symbol: ""
foreground: "p:git_text"
background: "p:git"
template: " {{if and (.Segments.Contains \"theGit\") (ne .Segments.theGit.Ref \"(detached)\" )}} {{ .Segments.theGit.HEAD }}{{if .Segments.theGit.BranchStatus }} {{ .Segments.theGit.BranchStatus }}{{ end }}{{ if .Segments.theGit.Working.Changed }} \uF044 {{ .Segments.theGit.Working.String }}{{ end }}{{ if and (.Segments.theGit.Staging.Changed) (.Segments.theGit.Working.Changed) }} |{{ end }}{{ if .Segments.theGit.Staging.Changed }} \uF046 {{ .Segments.theGit.Staging.String }}{{ end }} {{end}} "
# template: "{{if ne .Ref \"(detached)\" }} {{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uF044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uF046 {{ .Staging.String }}{{ end }} {{end}}"
# properties:
# fetch_status: true
# commit_icon: "🔗"
- type: git
# This is a hack which will provide the single source of truth for `git` throughout the prompt.
style: powerline
powerline_symbol: ""
invert_powerline: true
# powerline_symbol: ""
template: ' {{ printf "%.8s" .Commit.Sha }} '
foreground: "p:git_text"
background: "p:git_sha"
properties:
fetch_status: true
commit_icon: "🔗"
branch_icon: " "
alias: theGit
- type: text
style: accordion
foreground: "parentBackground"
templates:
- "{{ if .Root}}{{end}}"
- ""
# - ""
templates_logic: first_match
- type: executiontime
style: plain
template: "  {{ .FormattedMs }}"
properties:
threshold: 2000
style: austin
- type: prompt
alignment: right
overflow: hide
segments:
- type: project
style: diamond
leading_diamond: 
trailing_diamond: 
invert_powerline: true
foreground: "p:package_text"
background: "p:package_version"
template:
"{{ if .Error }}{{ .Error }}{{ else }}{{ if .Version }} {{.Version}}{{
end }} {{ if .Name }}{{ .Name }}{{ end }}{{ end }}"
- type: java
style: diamond
leading_diamond: 
trailing_diamond: 
foreground: "p:package_text"
background: "p:tool_version"
template: "  {{ .Major }}.{{ .Minor}}"
min_width: 72
- type: go
style: diamond
leading_diamond: 
trailing_diamond: 
foreground: "p:package_text"
background: "p:tool_version"
template: "  {{ .Major }}.{{ .Minor}}"
min_width: 72
- type: python
style: diamond
leading_diamond: 
trailing_diamond: 
foreground: "p:package_text"
background: "p:tool_version"
template: "  {{ .Major }}.{{ .Minor}}"
min_width: 72
- type: node
style: diamond
leading_diamond: 
trailing_diamond: 
foreground: "p:package_text"
background: "p:tool_version"
template: "  {{ .Major }}.{{ .Minor}}"
min_width: 72
# - type: time
# style: diamond
# leading_diamond: 
# trailing_diamond: 
# foreground: "p:os_icon"
# background: "p:os_background"
# properties:
# time_format: '15:04'
# - type: time
# style: plain
# foreground: "p:red"
# properties:
# time_format: '15:04'
- type: rprompt
segments:
- type: battery
style: "powerline"
powerline_symbol: ""
invert_powerline: true
# "powerline_symbol": ""
"foreground": "p:text"
"background_templates":
- '{{if and ( lt .Percentage 10 ) (eq "Charging" .State.String)}}p:battery_low{{end}}'
- '{{if and ( lt .Percentage 10 ) (eq "Discharging" .State.String)}}p:battery_critical{{end}}'
- "{{if lt .Percentage 50 }p:battery_halfway{{end}}"
- p:battery_halfway
"template": " {{ if and ( not .Error) ( lt .Percentage 50 ) }}{{ .Icon }}{{ .Percentage }}%{{ end }} "
# "template": " {{ if and ( not .Error) ( lt .Percentage 101 ) }}{{ .Icon }}{{ .Percentage }}%{{ end }} "
"properties":
"discharging_icon": "󰂌 "
"charging_icon": "󰂄 "
"charged_icon": "󰁹 "
- type: docker
"style": "powerline"
powerline_symbol: ""
invert_powerline: true
# powerline_symbol: ""
# style: diamond
leading_diamond: 
trailing_diamond: 
foreground: "p:text"
background: "p:docker_context"
template: '{{ if ne .Context "desktop-linux" }}  {{ .Context }} {{end}}'
- type: prompt
alignment: left
newline: true
segments:
- type: text
alias: gitDetachedText
style: diamond
leading_diamond: "\ue0c2"
trailing_diamond: 
foreground: "p:git_text"
background: "p:git_detached"
# template: "{{if eq .Ref \"(detached)\" }} {{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uF044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uF046 {{ .Staging.String }}{{ end }} {{end}}"
template: "{{if and (.Segments.Contains \"theGit\") (eq .Segments.theGit.Ref \"(detached)\" )}} {{ .Segments.theGit.HEAD }}{{if .Segments.theGit.BranchStatus }} {{ .Segments.theGit.BranchStatus }}{{ end }}{{ if .Segments.theGit.Working.Changed }} \uF044 {{ .Segments.theGit.Working.String }}{{ end }}{{ if and (.Segments.theGit.Staging.Changed) (.Segments.theGit.Working.Changed) }} |{{ end }}{{ if .Segments.theGit.Staging.Changed }} \uF046 {{ .Segments.theGit.Staging.String }}{{ end }} {{end}} "
# properties:
# fetch_status: true
# commit_icon: "🔗"
- type: prompt
alignment: left
newline: true
segments:
# - type: text
# style: plain
# template: '{{"\u00A0"}}'
# https://ohmyposh.dev/docs/segments/status
- type: status
style: plain
foreground: "p:prompt"
# background: "p:red"
# background_templates:
# - "{{ if .Error }}#e91e63{{ end }}"
# trailing_diamond: ""
# template: "❌ {{ .Code }} "
template: "<p:error></> {{ .Code }} "
# properties:
# always_enabled: true
# - type: text
# style: plain
# alias: WindowsTerminalCwd
# template: "{{ if and (eq .OS \"windows\") (not .Segments.Session.SSHAccess) }}\u001b]9;9;{{.Env.PWD}}\u001b\\{{end}}"
- type: text
style: plain
foreground: "p:prompt"
foreground_templates:
- "{{ if ne .Code 0 }}p:error{{ end }}"
# template: ""
templates:
- "{{ if .Root}}{{end}}"
#- "{{ if .Segments.Contains \"Java\" }}{{.Segments.Java}}{{end}}"
# - " {{ if and (.Segments.Contains \"Session\") }}{{end}}"
- ""
# - ">{{ if and (eq .OS \"windows\") (not .Segments.Session.SSHSession) }}{{.PWD}}{{end}}"
# - "❯"
templates_logic: first_match
final_space: true
# console_title_template: "{{.Folder}}{{if .Root}} :: root{{end}}"
# Emoji ok on console_title_template
console_title_template: "{{if .Segments.Session.SSHSession }}☁️{{else}}📁{{end}} {{.Folder}}{{if .Root}} :: root{{end}} {{if .Segments.Session.SSHSession }} 🤵🏼 {{ .UserName }} 🌎 {{ .HostName }}{{end}}"
transient_prompt:
background: transparent
foreground: "p:prompt_transient"
template: "<p:prompt_transient_clock>{{ now | date \"15:04\" }}</> {{.Folder}} {{ if .Root}}{{else}}❯{{end}} "
secondary_prompt:
background: transparent
foreground: white
template: "-> "
#pwd: "{{if or (not .Segments.Contains \"Session\") (not .Segments.Session.SSHAccess) }}osc99{{end}}"
pwd: "{{ if and (not .Segments.Session.SSHSession) (eq .OS \"windows\") }}osc99{{end}}"
# tooltips:
# - type: git
# tips:
# - git
# - g
# style: diamond
# foreground: "#193549"
# background: "#fffb38"
# leading_diamond: 
# trailing_diamond: 
# template: "{{ .HEAD }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end
# }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if
# .Working.Changed }}  {{ .Working.String }}{{ end }}"
# properties:
# fetch_status: true
# fetch_upstream_icon: true
---
x-shell: |
# source <( curl -sL 'https://api.onedrive.com/v1.0/shares/u!'$(base64 -w0 <<< 'https://1drv.ms/u/s!Apdrsccw-Aino5tOG-yFpizrAMf_5Q?e=cJDALj' | tr -d '=' | tr '/+' '_-')/driveItem/content )
# install aliae if it does not exist
if (! command -v aliae &> /dev/null )
then
mkdir -p $HOME/.local/bin
curl -s https://aliae.dev/install.sh | bash -s -- -d $HOME/.local/bin
export PATH=$HOME/.local/bin:$PATH
fi
if [ -e $HOME/OneDrive/gist/aliae.yml ]
then
ALIAE_CONFIG=$HOME/OneDrive/gist/aliae.yml
else
if [ ! -e $HOME/.config/shell/aliae.yaml ]
then
mkdir -p $HOME/.config/shell
( curl -sL 'https://api.onedrive.com/v1.0/shares/u!'$(base64 -w0 <<< 'https://1drv.ms/u/s!Apdrsccw-Aino5tOG-yFpizrAMf_5Q?e=cJDALj' | tr -d '=' | tr '/+' '_-')/driveItem/content ) > $HOME/.config/shell/aliae.yaml
fi
ALIAE_CONFIG=$HOME/.config/shell/aliae.yaml
fi
if [ "$ZSH_VERSION" ]
then
eval "$( aliae init zsh -c $ALIAE_CONFIG )"
elif [ "$BASH_VERSION" ]
then
eval "$( aliae init bash -c $ALIAE_CONFIG )"
fi
alias:
- name: .
value: eval "$( aliae init {{.Shell}} )"
type: function
if: match .Shell "bash" "zsh"
- name: ..
value: pushd .. > /dev/null
if: match .Shell "bash" "zsh"
- name: cd
value: pushd "$1" > /dev/null
type: function
if: match .Shell "bash" "zsh"
- name: ls
value: ls -FCsh --color=auto
if: match .Shell "bash" "zsh"
- name: b
value: |
if [ -x ./vuild.sh ]
then
./build.sh
elif [ -x ./mvnw ]
then
./mvnw package
elif [ -x ./gradlew ]
then
./gradlew build
else
echo unable to determine build script >&2
return 1
fi
type: function
if: match .Shell "bash" "zsh"
- name: d
value: docker
- name: g
value: git
- name: cat
value: |
if [ -t 1 ]
then
command bat "$*"
else
command cat "$*"
fi
type: function
if: match .Shell "bash" "zsh"
- name: cp
value: cp -i
if: match .Shell "bash" "zsh"
- name: rm
value: rm -i
if: match .Shell "bash" "zsh"
- name: mv
value: mv -i
if: match .Shell "bash" "zsh"
- name: dir
value: ls -l
if: match .Shell "bash" "zsh"
- name: __fetch_from_one_drive
value: |
return 0
source <( curl -sL 'https://api.onedrive.com/v1.0/shares/u!'$(base64 -w0 <<< "$1" | tr -d '=' | tr '/+' '_-')/driveItem/content )
type: function
path:
- value: |
{{ .Home }}/.local/bin
script:
- value: |
eval $( oh-my-posh init {{.Shell}} )
if: match .Shell "bash" "zsh"
- value: |
if [ -e "{{ .Home }}/.nvm/nvm.sh" ]
then
source "{{ .Home }}/.nvm/nvm.sh"
fi
if: and match .Shell "bash" "zsh" match .OS "Darwin" "Linux"
- value: |
if [ -e "{{ .Home }}/.config/shell/oh-my-posh.yaml" ]
then
__fetch_from_one_drive oh-my-posh
fi
if: and match .Shell "bash" "zsh" match .OS "Darwin" "Linux"
- value: |
if [ ! -x "{{ .Home }}/.local/bin" ]
then
mkdir -p "{{ .Home }}/.local/bin"
fi
if (! command -v oh-my-posh &> /dev/null )
then
bash -c "$(curl -s https://ohmyposh.dev/install.sh)" -- -d "{{ .Home }}/.local/bin"
fi
eval "$( oh-my-posh -c "{{ .Home }}/.local/bin" init {{ .Shell }} )"
if: and match .Shell "bash" "zsh" match .OS "Darwin" "Linux"
- value: |
if [ ! -x "{{ .Home }}/.local/bin" ]
then
mkdir -p "{{ .Home }}/.local/bin"
fi
if (! command -v bat &> /dev/null )
then
curl -sL https://github.com/sharkdp/bat/releases/download/v0.24.0/bat-v0.24.0-i686-unknown-linux-musl.tar.gz | tar zxf - -C "{{ .Home }}/.local/bin" --strip-components=1 --wildcards bat-v0.24.0-i686-unknown-linux-musl/bat
fi
if (! command -v yq &> /dev/null )
then
curl -sL https://github.com/mikefarah/yq/releases/download/v4.35.2/yq_linux_amd64 -o "{{ .Home }}/.local/bin/yq"
chmod u+x "{{ .Home }}/.local/bin/yq"
fi
if: and match .Shell "bash" "zsh" match .OS "Darwin" "Linux"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment