Merge branch 'master' into master

This commit is contained in:
Fred Klassen 2025-12-29 07:02:23 -08:00 committed by GitHub
commit f8d469a88b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
474 changed files with 13046 additions and 7165 deletions

View file

@ -106,6 +106,9 @@ function parse-commit {
message="${match[1]}"
# remove CR characters (might be inserted in GitHub UI commit description form)
message="${message//$'\r'/}"
# remove lines containing only whitespace
local nlnl=$'\n\n'
message="${message//$'\n'[[:space:]]##$'\n'/$nlnl}"
# skip next paragraphs (separated by two newlines or more)
message="${message%%$'\n\n'*}"
# ... and replace newlines with spaces
@ -157,6 +160,94 @@ function parse-commit {
fi
}
################################
# SUPPORTS HYPERLINKS FUNCTION #
################################
# The code for checking if a terminal supports hyperlinks is copied from install.sh
# The [ -t 1 ] check only works when the function is not called from
# a subshell (like in `$(...)` or `(...)`, so this hack redefines the
# function at the top level to always return false when stdout is not
# a tty.
if [ -t 1 ]; then
is_tty() {
true
}
else
is_tty() {
false
}
fi
# This function uses the logic from supports-hyperlinks[1][2], which is
# made by Kat Marchán (@zkat) and licensed under the Apache License 2.0.
# [1] https://github.com/zkat/supports-hyperlinks
# [2] https://crates.io/crates/supports-hyperlinks
#
# Copyright (c) 2021 Kat Marchán
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
supports_hyperlinks() {
# $FORCE_HYPERLINK must be set and be non-zero (this acts as a logic bypass)
if [ -n "$FORCE_HYPERLINK" ]; then
[ "$FORCE_HYPERLINK" != 0 ]
return $?
fi
# If stdout is not a tty, it doesn't support hyperlinks
is_tty || return 1
# DomTerm terminal emulator (domterm.org)
if [ -n "$DOMTERM" ]; then
return 0
fi
# VTE-based terminals above v0.50 (Gnome Terminal, Guake, ROXTerm, etc)
if [ -n "$VTE_VERSION" ]; then
[ $VTE_VERSION -ge 5000 ]
return $?
fi
# If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in
Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac
# These termcap entries support hyperlinks
case "$TERM" in
xterm-kitty|alacritty|alacritty-direct) return 0 ;;
esac
# xfce4-terminal supports hyperlinks
if [ "$COLORTERM" = "xfce4-terminal" ]; then
return 0
fi
# Windows Terminal also supports hyperlinks
if [ -n "$WT_SESSION" ]; then
return 0
fi
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
# if [ -n "$KONSOLE_VERSION" ]; then
# return 0
# fi
return 1
}
#############################
# RELEASE CHANGELOG DISPLAY #
#############################
@ -206,10 +297,17 @@ function display-release {
function fmt:hash {
#* Uses $hash from outer scope
local hash="${1:-$hash}"
local short_hash="${hash:0:7}" # 7 characters sha, top level sha is 12 characters
case "$output" in
raw) printf '%s' "$hash" ;;
text) printf '\e[33m%s\e[0m' "$hash" ;; # red
md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$hash" "$hash" ;;
raw) printf '%s' "$short_hash" ;;
text)
local text="\e[33m$short_hash\e[0m"; # red
if supports_hyperlinks; then
printf "\e]8;;%s\a%s\e]8;;\a" "https://github.com/ohmyzsh/ohmyzsh/commit/$hash" $text;
else
echo $text;
fi ;;
md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$short_hash" "$hash" ;;
esac
}
@ -272,7 +370,12 @@ function display-release {
case "$output" in
raw) printf '%s' "$subject" ;;
# In text mode, highlight (#<issue>) and dim text between `backticks`
text) sed -E $'s|#([0-9]+)|\e[32m#\\1\e[0m|g;s|`([^`]+)`|`\e[2m\\1\e[0m`|g' <<< "$subject" ;;
text)
if supports_hyperlinks; then
sed -E $'s|#([0-9]+)|\e]8;;https://github.com/ohmyzsh/ohmyzsh/issues/\\1\a\e[32m#\\1\e[0m\e]8;;\a|g;s|`([^`]+)`|`\e[2m\\1\e[0m`|g' <<< "$subject"
else
sed -E $'s|#([0-9]+)|\e[32m#\\1\e[0m|g;s|`([^`]+)`|`\e[2m\\1\e[0m`|g' <<< "$subject"
fi ;;
# In markdown mode, link to (#<issue>) issues
md) sed -E 's|#([0-9]+)|[#\1](https://github.com/ohmyzsh/ohmyzsh/issues/\1)|g' <<< "$subject" ;;
esac
@ -297,6 +400,9 @@ function display-release {
function display:breaking {
(( $#breaking != 0 )) || return 0
# If we reach here we have shown commits, set flag
shown_commits=1
case "$output" in
text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;;
raw) fmt:header "BREAKING CHANGES" 3 ;;
@ -324,6 +430,9 @@ function display-release {
# If no commits found of type $type, go to next type
(( $#hashes != 0 )) || return 0
# If we reach here we have shown commits, set flag
shown_commits=1
fmt:header "${TYPES[$type]}" 3
for hash in $hashes; do
echo " - $(fmt:hash) $(fmt:scope)$(fmt:subject)"
@ -341,6 +450,9 @@ function display-release {
# If no commits found under "other" types, don't display anything
(( $#changes != 0 )) || return 0
# If we reach here we have shown commits, set flag
shown_commits=1
fmt:header "Other changes" 3
for hash type in ${(kv)changes}; do
case "$type" in
@ -395,7 +507,7 @@ function main {
# Commit classification arrays
local -A types subjects scopes breaking reverts
local truncate=0 read_commits=0
local truncate=0 read_commits=0 shown_commits=0
local version tag
local hash refs subject body
@ -415,13 +527,13 @@ function main {
# Git log options
# -z: commits are delimited by null bytes
# --format: [7-char hash]<field sep>[ref names]<field sep>[subject]<field sep>[body]
# --abbrev=7: force commit hashes to be 7 characters long
# --abbrev=7: force commit hashes to be 12 characters long
# --no-merges: merge commits are omitted
# --first-parent: commits from merged branches are omitted
local SEP="0mZmAgIcSeP"
local -a raw_commits
raw_commits=(${(0)"$(command git -c log.showSignature=false log -z \
--format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=7 \
--format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=12 \
--no-merges --first-parent $range)"})
local raw_commit
@ -466,6 +578,10 @@ function main {
echo " ...more commits omitted"
echo
fi
if (( ! shown_commits )); then
echo "No changes to mention."
fi
}
# Use raw output if stdout is not a tty

View file

@ -9,6 +9,7 @@ fi
# - prompt (default): the user is asked before updating when it's time to update
# - auto: the update is performed automatically when it's time
# - reminder: a reminder is shown to the user when it's time to update
# - background-alpha: an experimental update-on-the-background option
# - disabled: automatic update is turned off
zstyle -s ':omz:update' mode update_mode || {
update_mode=prompt
@ -19,14 +20,16 @@ zstyle -s ':omz:update' mode update_mode || {
}
# Cancel update if:
# - the automatic update is disabled.
# - the current user doesn't have write permissions nor owns the $ZSH directory.
# - the automatic update is disabled
# - the current user doesn't have write permissions nor owns the $ZSH directory
# - is not run from a tty
# - git is unavailable on the system.
# - git is unavailable on the system
# - $ZSH is not a git repository
if [[ "$update_mode" = disabled ]] \
|| [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \
|| [[ ! -t 1 ]] \
|| ! command git --version 2>&1 >/dev/null; then
|| [[ ! -t 1 && ${POWERLEVEL9K_INSTANT_PROMPT:-off} == off ]] \
|| ! command git --version 2>&1 >/dev/null \
|| (builtin cd -q "$ZSH"; ! command git rev-parse --is-inside-work-tree &>/dev/null); then
unset update_mode
return
fi
@ -91,13 +94,42 @@ function is_update_available() {
}
function update_last_updated_file() {
echo "LAST_EPOCH=$(current_epoch)" >! "${ZSH_CACHE_DIR}/.zsh-update"
local exit_status="$1" error="$2"
if [[ -z "${1}${2}" ]]; then
echo "LAST_EPOCH=$(current_epoch)" >! "${ZSH_CACHE_DIR}/.zsh-update"
return
fi
cat >! "${ZSH_CACHE_DIR}/.zsh-update" <<EOD
LAST_EPOCH=$(current_epoch)
EXIT_STATUS=${exit_status}
ERROR='${error//\'/}'
EOD
}
function update_ohmyzsh() {
local verbose_mode
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
if ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode; then
# Force verbose mode to silent if p10k instant prompt is enabled
if [[ ${POWERLEVEL9K_INSTANT_PROMPT:-off} != "off" ]]; then
verbose_mode=silent
fi
if [[ "$update_mode" != background-alpha ]] \
&& LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode; then
update_last_updated_file
return $?
fi
local exit_status error
if error=$(LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v silent 2>&1); then
update_last_updated_file 0 "Update successful"
else
exit_status=$?
update_last_updated_file $exit_status "$error"
return $exit_status
fi
}
@ -126,87 +158,145 @@ function has_typed_input() {
}
}
() {
emulate -L zsh
function handle_update() {
() {
emulate -L zsh
local epoch_target mtime option LAST_EPOCH
local epoch_target mtime option LAST_EPOCH
# Remove lock directory if older than a day
zmodload zsh/datetime
zmodload -F zsh/stat b:zstat
if mtime=$(zstat +mtime "$ZSH/log/update.lock" 2>/dev/null); then
if (( (mtime + 3600 * 24) < EPOCHSECONDS )); then
command rm -rf "$ZSH/log/update.lock"
# Remove lock directory if older than a day
zmodload zsh/datetime
zmodload -F zsh/stat b:zstat
if mtime=$(zstat +mtime "$ZSH/log/update.lock" 2>/dev/null); then
if (( (mtime + 3600 * 24) < EPOCHSECONDS )); then
command rm -rf "$ZSH/log/update.lock"
fi
fi
fi
# Check for lock directory
if ! command mkdir "$ZSH/log/update.lock" 2>/dev/null; then
return
fi
# Check for lock directory
if ! command mkdir "$ZSH/log/update.lock" 2>/dev/null; then
return
fi
# Remove lock directory on exit. `return $ret` is important for when trapping a SIGINT:
# The return status from the function is handled specially. If it is zero, the signal is
# assumed to have been handled, and execution continues normally. Otherwise, the shell
# will behave as interrupted except that the return status of the trap is retained.
# This means that for a CTRL+C, the trap needs to return the same exit status so that
# the shell actually exits what it's running.
trap "
ret=\$?
unset update_mode
unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh 2>/dev/null
command rm -rf '$ZSH/log/update.lock'
return \$ret
" EXIT INT QUIT
# Remove lock directory on exit. `return $ret` is important for when trapping a SIGINT:
# The return status from the function is handled specially. If it is zero, the signal is
# assumed to have been handled, and execution continues normally. Otherwise, the shell
# will behave as interrupted except that the return status of the trap is retained.
# This means that for a CTRL+C, the trap needs to return the same exit status so that
# the shell actually exits what it's running.
trap "
ret=\$?
unset update_mode
unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh handle_update 2>/dev/null
command rm -rf '$ZSH/log/update.lock'
return \$ret
" EXIT INT QUIT
# Create or update .zsh-update file if missing or malformed
if ! source "${ZSH_CACHE_DIR}/.zsh-update" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then
update_last_updated_file
return
fi
# Create or update .zsh-update file if missing or malformed
if ! source "${ZSH_CACHE_DIR}/.zsh-update" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then
update_last_updated_file
return
fi
# Number of days before trying to update again
zstyle -s ':omz:update' frequency epoch_target || epoch_target=${UPDATE_ZSH_DAYS:-13}
# Test if enough time has passed until the next update
if (( ( $(current_epoch) - $LAST_EPOCH ) < $epoch_target )); then
return
fi
# Number of days before trying to update again
zstyle -s ':omz:update' frequency epoch_target || epoch_target=${UPDATE_ZSH_DAYS:-13}
# Test if enough time has passed until the next update
if (( ( $(current_epoch) - $LAST_EPOCH ) < $epoch_target )); then
return
fi
# Test if Oh My Zsh directory is a git repository
if ! (builtin cd -q "$ZSH" && LANG= git rev-parse &>/dev/null); then
echo >&2 "[oh-my-zsh] Can't update: not a git repository."
return
fi
# Test if Oh My Zsh directory is a git repository
if ! (builtin cd -q "$ZSH" && LANG= git rev-parse &>/dev/null); then
echo >&2 "[oh-my-zsh] Can't update: not a git repository."
return
fi
# Check if there are updates available before proceeding
if ! is_update_available; then
return
fi
# Check if there are updates available before proceeding
if ! is_update_available; then
update_last_updated_file
return
fi
# If in reminder mode or user has typed input, show reminder and exit
if [[ "$update_mode" = reminder ]] || has_typed_input; then
printf '\r\e[0K' # move cursor to first column and clear whole line
echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
return 0
fi
# If in reminder mode or user has typed input, show reminder and exit
if [[ "$update_mode" = reminder ]] || { [[ "$update_mode" != background-alpha ]] && has_typed_input }; then
printf '\r\e[0K' # move cursor to first column and clear whole line
echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
return 0
fi
# Don't ask for confirmation before updating if in auto mode
if [[ "$update_mode" = auto ]]; then
update_ohmyzsh
return $?
fi
# Don't ask for confirmation before updating if in auto mode
if [[ "$update_mode" = (auto|background-alpha) ]]; then
update_ohmyzsh
return $?
fi
# Ask for confirmation and only update on 'y', 'Y' or Enter
# Otherwise just show a reminder for how to update
echo -n "[oh-my-zsh] Would you like to update? [Y/n] "
read -r -k 1 option
[[ "$option" = $'\n' ]] || echo
case "$option" in
[yY$'\n']) update_ohmyzsh ;;
[nN]) update_last_updated_file ;&
*) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;;
esac
# Ask for confirmation and only update on 'y', 'Y' or Enter
# Otherwise just show a reminder for how to update
printf "[oh-my-zsh] Would you like to update? [Y/n] "
read -r -k 1 option
[[ "$option" = $'\n' ]] || echo
case "$option" in
[yY$'\n']) update_ohmyzsh ;;
[nN]) update_last_updated_file ;&
*) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;;
esac
}
unset update_mode
unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh handle_update
}
unset update_mode
unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh
case "$update_mode" in
background-alpha)
autoload -Uz add-zsh-hook
_omz_bg_update() {
# do the update in a subshell
(handle_update) &|
# register update results function
add-zsh-hook precmd _omz_bg_update_status
# deregister background function
add-zsh-hook -d precmd _omz_bg_update
unset -f _omz_bg_update
}
_omz_bg_update_status() {
{
local LAST_EPOCH EXIT_STATUS ERROR
if [[ ! -f "$ZSH_CACHE_DIR"/.zsh-update ]]; then
return 1
fi
# check update results until timeout is reached
. "$ZSH_CACHE_DIR/.zsh-update"
if [[ -z "$EXIT_STATUS" || -z "$ERROR" ]]; then
return 1
fi
if [[ "$EXIT_STATUS" -eq 0 ]]; then
print -P "\n%F{green}[oh-my-zsh] Update successful.%f"
return 0
elif [[ "$EXIT_STATUS" -ne 0 ]]; then
print -P "\n%F{red}[oh-my-zsh] There was an error updating:%f"
printf "\n${fg[yellow]}%s${reset_color}" "${ERROR}"
return 0
fi
} always {
if (( TRY_BLOCK_ERROR == 0 )); then
# if last update results have been handled, remove them from the status file
update_last_updated_file
# deregister background function
add-zsh-hook -d precmd _omz_bg_update_status
unset -f _omz_bg_update_status
fi
}
}
add-zsh-hook precmd _omz_bg_update
;;
*)
handle_update ;;
esac

View file

@ -25,9 +25,10 @@
# BRANCH - branch to check out immediately after install (default: master)
#
# Other options:
# CHSH - 'no' means the installer will not change the default shell (default: yes)
# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
# KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no)
# CHSH - 'no' means the installer will not change the default shell (default: yes)
# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
# KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no)
# OVERWRITE_CONFIRMATION - 'no' means the installer will not ask for confirmation to overwrite the existing .zshrc (default: yes)
#
# You can also pass some arguments to the install script to set some these options:
# --skip-chsh: has the same behavior as setting CHSH to 'no'
@ -63,7 +64,9 @@ zdot="${ZDOTDIR:-$HOME}"
# Default value for $ZSH
# a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh
# b) otherwise, $HOME/.oh-my-zsh
[ "$ZDOTDIR" = "$HOME" ] || ZSH="${ZSH:-${ZDOTDIR:+$ZDOTDIR/ohmyzsh}}"
if [ -n "$ZDOTDIR" ] && [ "$ZDOTDIR" != "$HOME" ]; then
ZSH="${ZSH:-$ZDOTDIR/ohmyzsh}"
fi
ZSH="${ZSH:-$HOME/.oh-my-zsh}"
# Default settings
@ -75,6 +78,7 @@ BRANCH=${BRANCH:-master}
CHSH=${CHSH:-yes}
RUNZSH=${RUNZSH:-yes}
KEEP_ZSHRC=${KEEP_ZSHRC:-no}
OVERWRITE_CONFIRMATION=${OVERWRITE_CONFIRMATION:-yes}
command_exists() {
@ -84,6 +88,10 @@ command_exists() {
user_can_sudo() {
# Check if sudo is installed
command_exists sudo || return 1
# Termux can't run sudo, so we can detect it and exit the function early.
case "$PREFIX" in
*com.termux*) return 1 ;;
esac
# The following command has 3 parts:
#
# 1. Run `sudo` with `-v`. Does the following:
@ -160,11 +168,16 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in
Hyper|iTerm.app|terminology|WezTerm) return 0 ;;
Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac
# kitty supports hyperlinks
if [ "$TERM" = xterm-kitty ]; then
# These termcap entries support hyperlinks
case "$TERM" in
xterm-kitty|alacritty|alacritty-direct) return 0 ;;
esac
# xfce4-terminal supports hyperlinks
if [ "$COLORTERM" = "xfce4-terminal" ]; then
return 0
fi
@ -331,6 +344,25 @@ setup_zshrc() {
echo "${FMT_YELLOW}Found ${zdot}/.zshrc.${FMT_RESET} ${FMT_GREEN}Keeping...${FMT_RESET}"
return
fi
if [ $OVERWRITE_CONFIRMATION != "no" ]; then
# Ask user for confirmation before backing up and overwriting
echo "${FMT_YELLOW}Found ${zdot}/.zshrc."
echo "The existing .zshrc will be backed up to .zshrc.pre-oh-my-zsh if overwritten."
echo "Make sure your .zshrc contains the following minimal configuration if you choose not to overwrite it:${FMT_RESET}"
echo "----------------------------------------"
cat "$ZSH/templates/minimal.zshrc"
echo "----------------------------------------"
printf '%sDo you want to overwrite it with the Oh My Zsh template? [Y/n]%s ' \
"$FMT_YELLOW" "$FMT_RESET"
read -r opt
case $opt in
[Yy]*|"") ;;
[Nn]*) echo "Overwrite skipped. Existing .zshrc will be kept."; return ;;
*) echo "Invalid choice. Overwrite skipped. Existing .zshrc will be kept."; return ;;
esac
fi
if [ -e "$OLD_ZSHRC" ]; then
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
if [ -e "$OLD_OLD_ZSHRC" ]; then
@ -343,7 +375,7 @@ setup_zshrc() {
echo "${FMT_YELLOW}Found old .zshrc.pre-oh-my-zsh." \
"${FMT_GREEN}Backing up to ${OLD_OLD_ZSHRC}${FMT_RESET}"
fi
echo "${FMT_YELLOW}Found ${zdot}/.zshrc.${FMT_RESET} ${FMT_GREEN}Backing up to ${OLD_ZSHRC}${FMT_RESET}"
echo "${FMT_GREEN}Backing up to ${OLD_ZSHRC}${FMT_RESET}"
mv "$zdot/.zshrc" "$OLD_ZSHRC"
fi
@ -389,8 +421,8 @@ EOF
"$FMT_YELLOW" "$FMT_RESET"
read -r opt
case $opt in
y*|Y*|"") ;;
n*|N*) echo "Shell change skipped."; return ;;
[Yy]*|"") ;;
[Nn]*) echo "Shell change skipped."; return ;;
*) echo "Invalid choice. Shell change skipped."; return ;;
esac
@ -472,9 +504,9 @@ print_success() {
"$(fmt_code "$(fmt_link ".zshrc" "file://$zdot/.zshrc" --text)")" \
"file to select plugins, themes, and options."
printf '\n'
printf '%s\n' "• Follow us on Twitter: $(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)"
printf '%s\n' "• Follow us on X: $(fmt_link @ohmyzsh https://x.com/ohmyzsh)"
printf '%s\n' "• Join our Discord community: $(fmt_link "Discord server" https://discord.gg/ohmyzsh)"
printf '%s\n' "• Get stickers, t-shirts, coffee mugs and more: $(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)"
printf '%s\n' "• Get stickers, t-shirts, coffee mugs and more: $(fmt_link "CommitGoods Shop" https://commitgoods.com/collections/oh-my-zsh)"
printf '%s\n' $FMT_RESET
}
@ -483,12 +515,13 @@ main() {
if [ ! -t 0 ]; then
RUNZSH=no
CHSH=no
OVERWRITE_CONFIRMATION=no
fi
# Parse arguments
while [ $# -gt 0 ]; do
case $1 in
--unattended) RUNZSH=no; CHSH=no ;;
--unattended) RUNZSH=no; CHSH=no; OVERWRITE_CONFIRMATION=no ;;
--skip-chsh) CHSH=no ;;
--keep-zshrc) KEEP_ZSHRC=yes ;;
esac

View file

@ -1,4 +1,4 @@
#!/bin/zsh
#!/usr/bin/env zsh
# Zsh Theme Chooser by fox (fox91 at anche dot no)
# This program is free software. It comes without any warranty, to

View file

@ -1,4 +1,7 @@
#!/usr/bin/env zsh
set +u # disable nounset
local ret=0 # exit code
# Protect against running with shells other than zsh
if [ -z "$ZSH_VERSION" ]; then
@ -7,9 +10,14 @@ fi
# Protect against unwanted sourcing
case "$ZSH_EVAL_CONTEXT" in
*:file) echo "error: this file should not be sourced" && return ;;
*:file) echo "error: this file should not be sourced" && return 1 ;;
esac
# Define "$ZSH" if not defined -- in theory this should be `export`ed by the calling script
if [[ -z "$ZSH" ]]; then
ZSH="${0:a:h:h}"
fi
cd "$ZSH"
verbose_mode="default"
@ -87,11 +95,16 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in
Hyper|iTerm.app|terminology|WezTerm) return 0 ;;
Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac
# kitty supports hyperlinks
if [ "$TERM" = xterm-kitty ]; then
# These termcap entries support hyperlinks
case "$TERM" in
xterm-kitty|alacritty|alacritty-direct) return 0 ;;
esac
# xfce4-terminal supports hyperlinks
if [ "$COLORTERM" = "xfce4-terminal" ]; then
return 0
fi
@ -181,17 +194,23 @@ fi
# Update upstream remote to ohmyzsh org
git remote -v | while read remote url extra; do
case "$url" in
https://github.com/robbyrussell/oh-my-zsh(|.git))
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
break ;;
git@github.com:robbyrussell/oh-my-zsh(|.git))
git remote set-url "$remote" "git@github.com:ohmyzsh/ohmyzsh.git"
break ;;
# Update out-of-date "unauthenticated git protocol on port 9418" to https
git://github.com/robbyrussell/oh-my-zsh(|.git))
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
break ;;
# Update out-of-date "unauthenticated git protocol on port 9418" to https
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git" ;;
https://github.com/robbyrussell/oh-my-zsh(|.git))
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git" ;;
git@github.com:robbyrussell/oh-my-zsh(|.git))
git remote set-url "$remote" "git@github.com:ohmyzsh/ohmyzsh.git" ;;
https://github.com/ohmyzsh/ohmyzsh(|.git)) ;;
git@github.com:ohmyzsh/ohmyzsh(|.git)) ;;
*) continue ;;
esac
# If we reach this point we have found the proper ohmyzsh upstream remote. If we don't,
# we'll only update from the set remote if `oh-my-zsh.remote` has been set to a remote,
# as when installing from a fork.
git config --local oh-my-zsh.remote "$remote"
break
done
# Set git-config values known to fix git errors
@ -234,8 +253,8 @@ if LANG= git pull --quiet --rebase $remote $branch; then
git config oh-my-zsh.lastVersion "$last_commit"
# Print changelog to the terminal
if [[ interactive == true && $verbose_mode == default ]] ; then
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
if [[ $interactive == true && $verbose_mode == default ]]; then
ZSH="$ZSH" command zsh -f "$ZSH/tools/changelog.sh" HEAD "$last_commit"
fi
if [[ $verbose_mode != silent ]]; then
@ -252,9 +271,9 @@ if LANG= git pull --quiet --rebase $remote $branch; then
printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET
printf '\n'
printf "${BLUE}%s${RESET}\n\n" "$message"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "To keep up with the latest news and updates, follow us on Twitter:" "$(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "To keep up with the latest news and updates, follow us on X:" "$(fmt_link @ohmyzsh https://x.com/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "Want to get involved in the community? Join our Discord:" "$(fmt_link "Discord server" https://discord.gg/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "Get your Oh My Zsh swag at:" "$(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)"
printf "${BLUE}${BOLD}%s %s${RESET}\n" "Get your Oh My Zsh swag at:" "$(fmt_link "CommitGoods Shop" https://commitgoods.com/collections/oh-my-zsh)"
elif [[ $verbose_mode == minimal ]]; then
printf "${BLUE}%s${RESET}\n" "$message"
fi