1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-04-10 16:32:00 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Romeo Morcia
92dded1f0e Merge 28145c2239 into 887a864aba 2026-04-07 09:32:08 +02:00
Romeo Morcia
28145c2239 Added the possibility of showing all preferred themes in .zsh_favlist file 2023-03-26 14:14:42 +02:00
3 changed files with 28 additions and 13 deletions

View File

@@ -30,20 +30,14 @@ function tofu_version_prompt_info() {
alias tt='tofu'
alias tta='tofu apply'
alias tta!='tofu apply -auto-approve'
alias ttap='tofu apply -parallelism=1'
alias ttapp='tofu apply tfplan'
alias ttc='tofu console'
alias ttd='tofu destroy'
alias ttd!='tofu destroy -auto-approve'
alias ttf='tofu fmt'
alias ttfr='tofu fmt -recursive'
alias tti='tofu init'
alias ttir='tofu init -reconfigure'
alias ttiu='tofu init -upgrade'
alias ttiur='tofu init -upgrade -reconfigure'
alias tto='tofu output'
alias ttp='tofu plan'
alias ttpo='tofu plan -out tfplan'
alias ttv='tofu validate'
alias tts='tofu state'
alias ttsh='tofu show'

View File

@@ -4,21 +4,21 @@ function tf_prompt_info() {
# check if in terraform dir and file exists
[[ -d "${TF_DATA_DIR:-.terraform}" && -r "${TF_DATA_DIR:-.terraform}/environment" ]] || return
local workspace="$(<"${TF_DATA_DIR:-.terraform}/environment")"
local workspace="$(< "${TF_DATA_DIR:-.terraform}/environment")"
echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}"
}
function tf_version_prompt_info() {
local terraform_version
terraform_version=$(terraform --version | head -n 1 | cut -d ' ' -f 2)
echo "${ZSH_THEME_TF_VERSION_PROMPT_PREFIX-[}${terraform_version:gs/%/%%}${ZSH_THEME_TF_VERSION_PROMPT_SUFFIX-]}"
local terraform_version
terraform_version=$(terraform --version | head -n 1 | cut -d ' ' -f 2)
echo "${ZSH_THEME_TF_VERSION_PROMPT_PREFIX-[}${terraform_version:gs/%/%%}${ZSH_THEME_TF_VERSION_PROMPT_SUFFIX-]}"
}
alias tf='terraform'
alias tfa='terraform apply'
alias tfa!='terraform apply -auto-approve'
alias tfap='terraform apply -parallelism=1'
alias tfapp='terraform apply tfplan'
alias tfc='terraform console'
alias tfd='terraform destroy'
alias tfd!='terraform destroy -auto-approve'
@@ -31,7 +31,6 @@ alias tfiu='terraform init -upgrade'
alias tfiur='terraform init -upgrade -reconfigure'
alias tfo='terraform output'
alias tfp='terraform plan'
alias tfpo='terraform plan -out tfplan'
alias tfv='terraform validate'
alias tfs='terraform state'
alias tft='terraform test'

24
tools/theme_chooser.sh Executable file → Normal file
View File

@@ -29,6 +29,25 @@ function theme_preview() {
print -P "$PROMPT $RPROMPT"
}
function fav_theme_preview() {
if [[ -s $FAVLIST ]]; then
for THEME_NAME in $(cat $FAVLIST); do
THEME="$THEME_NAME.zsh-theme"
print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color"
source "$THEMES_DIR/$THEME"
cols=$(tput cols)
(exit 1)
print -P "$PROMPT $RPROMPT"
done
else
if ! noyes "No ($FAVLIST) in the system. Do you want to preview all the available themes?"; then
theme_chooser 0
else
echo "Okay, exiting."
fi
fi
}
function banner() {
echo
echo "╺━┓┏━┓╻ ╻ ╺┳╸╻ ╻┏━╸┏┳┓┏━╸ ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓"
@@ -43,6 +62,7 @@ function usage() {
echo "Options"
echo " -l List available themes"
echo " -s Show all themes"
echo " -f Show favourite themes"
echo " -h Get this help message"
exit 1
}
@@ -77,11 +97,12 @@ function theme_chooser() {
done
}
while getopts ":lhs" Option
while getopts ":lhsf" Option
do
case $Option in
l ) list_themes ;;
s ) theme_chooser 0 ;;
f ) fav_theme_preview ;;
h ) usage ;;
* ) usage ;; # Default.
esac
@@ -96,3 +117,4 @@ if [[ -z $Option ]]; then
theme_preview $1".zsh-theme"
fi
fi