mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-23 17:03:03 +01:00
Compare commits
17
Commits
17a2b4c3a5
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87aa1a9b89 | ||
|
|
ca0a63f0ee | ||
|
|
a7f4e49946 | ||
|
|
3ecde00d94 | ||
|
|
902761f897 | ||
|
|
c0140703a5 | ||
|
|
ffe93241cc | ||
|
|
ca82ba6831 | ||
|
|
e957b67eed | ||
|
|
6010fb6260 | ||
|
|
044bcbf82d | ||
|
|
2d03d8ac01 | ||
|
|
f5d571c66d | ||
|
|
cca3bdfbef | ||
|
|
59ff4d042e | ||
|
|
b509b1c6ed | ||
|
|
c483ff288d |
No files matched your search
@@ -16,7 +16,7 @@ jobs:
|
||||
contents: write # this is needed to push commits and branches
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
certifi==2026.10.19
|
||||
certifi==2026.10.23
|
||||
charset-normalizer==3.5.2
|
||||
idna==3.20
|
||||
PyYAML==6.0.3
|
||||
requests==2.34.2
|
||||
semver==3.1.0
|
||||
semver==3.1.1
|
||||
urllib3==2.8.0
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
- test
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
- name: Authenticate as @ohmyzsh
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
||||
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -60,6 +60,6 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -1,5 +1,5 @@
|
||||
alias-finder() {
|
||||
local cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter=""
|
||||
local c="" cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter="" cmdLen=""
|
||||
|
||||
# build command and options
|
||||
for c in "$@"; do
|
||||
@@ -19,11 +19,15 @@ alias-finder() {
|
||||
zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true
|
||||
|
||||
# format cmd for grep
|
||||
## - replace newlines with spaces
|
||||
## - replace newlines and multiple spaces with one space
|
||||
## - trim both ends
|
||||
## - replace multiple spaces with one space
|
||||
## - add escaping character to special characters
|
||||
cmd=$(echo -n "$cmd" | tr '\n' ' ' | xargs | tr -s '[:space:]' | sed 's/[].\|$(){}?+*^[]/\\&/g')
|
||||
setopt localoptions extendedglob
|
||||
cmd=${cmd//[[:space:]]##/ }
|
||||
cmd=${cmd# }
|
||||
cmd=${cmd% }
|
||||
local esc_pattern='(#m)[][.\\|$(){}?+*^]' MATCH MBEGIN MEND
|
||||
cmd=${cmd//${~esc_pattern}/\\$MATCH}
|
||||
|
||||
if [[ $longer == true ]]; then
|
||||
wordEnd="" # remove wordEnd to find longer aliases
|
||||
@@ -35,7 +39,7 @@ alias-finder() {
|
||||
|
||||
# make filter to find only shorter results than current cmd
|
||||
if [[ $cheaper == true ]]; then
|
||||
cmdLen=$(echo -n "$cmd" | wc -c)
|
||||
cmdLen=${#cmd}
|
||||
if [[ $cmdLen -le 1 ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -25,7 +25,7 @@ plugins=(... drush)
|
||||
| `drcr` | `drush core-cron` | Run all cron hooks in all active modules for specified site |
|
||||
| `drct` | `drush cc theme-registry` | Clear theme-registry cache |
|
||||
| `drcv` | `drush cc views` | Clear views cache _(make sure that the views module is enabled)_ |
|
||||
| `drdmp` | `drush drush sql-dump --ordered-dump --result-file=dumpsql` | Backup database in a new dump.sql file |
|
||||
| `drdmp` | `drush sql-dump --ordered-dump --result-file=dump.sql` | Backup database in a new dump.sql file |
|
||||
| `drf` | `drush features` | Display features status |
|
||||
| `drfr` | `drush features-revert -y` | Revert a feature module on your site |
|
||||
| `drfra` | `drush features-revert-all` | Revert all enabled feature module on your site |
|
||||
|
||||
@@ -7,6 +7,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||
search_locations=(
|
||||
"$HOME/google-cloud-sdk"
|
||||
"/usr/local/share/google-cloud-sdk"
|
||||
"/usr/local/google-cloud-sdk"
|
||||
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||
"/opt/homebrew/share/google-cloud-sdk"
|
||||
|
||||
@@ -86,8 +86,7 @@ print(unquote_plus(sys.stdin.read()))
|
||||
function pp_json() {
|
||||
ruby -e '
|
||||
require "json"
|
||||
require "yaml"
|
||||
puts JSON.parse(STDIN.read).to_yaml
|
||||
puts JSON.pretty_generate(JSON.parse(STDIN.read), indent: " ")
|
||||
'
|
||||
}
|
||||
function is_json() {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Run with: zsh -df plugins/jsontools/tests/jsontools-ruby.test.zsh
|
||||
emulate -L zsh
|
||||
setopt err_return
|
||||
|
||||
(( $+commands[ruby] )) || {
|
||||
print -u2 'These tests require Ruby.'
|
||||
exit 1
|
||||
}
|
||||
|
||||
JSONTOOLS_METHOD=ruby
|
||||
source "${0:A:h:h}/jsontools.plugin.zsh"
|
||||
local test_dir=$(mktemp -d)
|
||||
|
||||
check_output() {
|
||||
local tool=$1 description=$2 expected_status=${3:-0}
|
||||
local -i result=0
|
||||
$tool < "$test_dir/input" > "$test_dir/actual" || result=$?
|
||||
if (( result != expected_status )) \
|
||||
|| ! cmp -s "$test_dir/expected" "$test_dir/actual"; then
|
||||
print -u2 -r -- "FAIL: $description ($tool exited $result)"
|
||||
return 1
|
||||
fi
|
||||
print -r -- "PASS: $description"
|
||||
}
|
||||
|
||||
{
|
||||
# pp_json prints JSON with the same 4-space indent as the node and python3 methods.
|
||||
print -rn -- '{"value":42}' > "$test_dir/input"
|
||||
printf '{\n "value": 42\n}\n' > "$test_dir/expected"
|
||||
check_output pp_json 'pretty-print a small document'
|
||||
|
||||
print -rn -- '{"list":[1,"two"],"nested":{"a":null,"b":true}}' > "$test_dir/input"
|
||||
printf '{\n "list": [\n 1,\n "two"\n ],\n "nested": {\n "a": null,\n "b": true\n }\n}\n' \
|
||||
> "$test_dir/expected"
|
||||
check_output pp_json 'pretty-print a nested document'
|
||||
|
||||
printf '{"a":1}\n[2]\n' > "$test_dir/input"
|
||||
printf '{\n "a": 1\n}\n[\n 2\n]\n' > "$test_dir/expected"
|
||||
check_output pp_ndjson 'pretty-print NDJSON'
|
||||
|
||||
print -rn -- '{"value":42}' > "$test_dir/input"
|
||||
print -r -- true > "$test_dir/expected"
|
||||
check_output is_json 'validate a document'
|
||||
|
||||
print -rn -- '{invalid}' > "$test_dir/input"
|
||||
print -r -- false > "$test_dir/expected"
|
||||
check_output is_json 'reject invalid JSON' 1
|
||||
|
||||
print 'All jsontools Ruby tests passed.'
|
||||
} always {
|
||||
rm -rf -- "$test_dir"
|
||||
}
|
||||
@@ -347,6 +347,13 @@ function listMavenCompletions {
|
||||
)
|
||||
}
|
||||
|
||||
compctl -K listMavenCompletions mvn mvnw
|
||||
compctl -K listMavenCompletions mvn-color
|
||||
compctl -K listMavenCompletions mvn-or-mvnw
|
||||
# Completion, via compsys so that tools built on it (fzf-tab, etc.) can take over.
|
||||
_mvn() {
|
||||
local -a commands
|
||||
listMavenCompletions
|
||||
# _describe splits entries on `:`, so escape it to keep goals like `dependency:tree`.
|
||||
commands=("${(@)reply//:/\\:}")
|
||||
_describe -t mvn-commands 'mvn command' commands
|
||||
}
|
||||
|
||||
compdef _mvn mvn mvnw mvn-color mvn-or-mvnw
|
||||
@@ -16,7 +16,7 @@ plugins=(... npm)
|
||||
| `npmS` | `npm i -S` | Install and save to dependencies in your package.json |
|
||||
| `npmD` | `npm i -D` | Install and save to dev-dependencies in your package.json |
|
||||
| `npmF` | `npm i -f` | Force install from remote registries ignoring local cache |
|
||||
| `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory |
|
||||
| `npmE` | `PATH="$(npm root)/.bin":"$PATH"` | Run command from node_modules folder based on current directory |
|
||||
| `npmO` | `npm outdated` | Check which npm modules are outdated |
|
||||
| `npmU` | `npm update` | Update all the packages listed to the latest version |
|
||||
| `npmV` | `npm -v` | Check package versions |
|
||||
|
||||
@@ -32,7 +32,7 @@ alias npmF='npm i -f'
|
||||
|
||||
# Execute command from node_modules folder based on current directory
|
||||
# i.e npmE gulp
|
||||
alias npmE='PATH="$(npm bin)":"$PATH"'
|
||||
alias npmE='PATH="$(npm root)/.bin":"$PATH"'
|
||||
|
||||
# Check which npm modules are outdated
|
||||
alias npmO="npm outdated"
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Run with: zsh -df plugins/timer/tests/timer.test.zsh
|
||||
emulate -L zsh
|
||||
|
||||
source "${0:A:h:h}/timer.plugin.zsh"
|
||||
|
||||
typeset -i failures=0 tests=0
|
||||
|
||||
check_duration() {
|
||||
local precision=$1 duration=$2 expected=$3
|
||||
local output=$(TIMER_PRECISION=$precision __timer_format_duration $duration)
|
||||
(( tests++ ))
|
||||
|
||||
if [[ $output == "$expected" ]]; then
|
||||
print -r -- "PASS: $duration with precision $precision -> $output"
|
||||
else
|
||||
print -u2 -r -- "FAIL: $duration with precision $precision -> $output (expected $expected)"
|
||||
(( failures++ ))
|
||||
fi
|
||||
}
|
||||
|
||||
check_duration 1 0.04 /0.0s
|
||||
check_duration 1 3.04 /3.0s
|
||||
check_duration 1 40.0 /40.0s
|
||||
check_duration 1 59.94 /59.9s
|
||||
check_duration 1 59.97 /1m0.0s
|
||||
check_duration 1 61.5 /1m1.5s
|
||||
check_duration 1 73.0 /1m13.0s
|
||||
check_duration 1 119.97 /2m0.0s
|
||||
check_duration 1 3599.99 /60m0.0s
|
||||
check_duration 2 59.996 /1m0.00s
|
||||
check_duration 2 0.02 /0.02s
|
||||
check_duration 0 1.4 /1s
|
||||
check_duration 0 59.6 /1m0s
|
||||
check_duration 0 119.5 /2m0s
|
||||
|
||||
print -r -- "$tests tests, $failures failures"
|
||||
(( failures == 0 ))
|
||||
@@ -6,8 +6,14 @@ __timer_current_time() {
|
||||
}
|
||||
|
||||
__timer_format_duration() {
|
||||
local mins=$(printf '%.0f' $(($(IFS='.' read int dec <<< "$1"; echo $int) / 60)))
|
||||
local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins)))
|
||||
local -i precision=${TIMER_PRECISION:-1}
|
||||
local -i scale=$(( 10 ** precision ))
|
||||
# Round to the displayed precision before splitting off the minutes,
|
||||
# so that e.g. 59.97s is shown as 1m0.0s instead of 60.0s
|
||||
local -i units
|
||||
(( units = $1 * scale + 0.5 ))
|
||||
local -i mins=$(( units / (60 * scale) ))
|
||||
local secs=$(printf "%.${precision}f" $(( (units - 60 * scale * mins) / (scale * 1.0) )))
|
||||
local duration_str=$(echo "${mins}m${secs}s")
|
||||
local format="${TIMER_FORMAT:-/%d}"
|
||||
echo "${format//\%d/${duration_str#0m}}"
|
||||
|
||||
@@ -43,7 +43,6 @@ Available search contexts are:
|
||||
| `wolframalpha` | `https://wolframalpha.com/input?i=` |
|
||||
| `archive` | `https://web.archive.org/web/*/` |
|
||||
| `scholar` | `https://scholar.google.com/scholar?q=` |
|
||||
| `ask` | `https://www.ask.com/web?q=` |
|
||||
| `youtube` | `https://www.youtube.com/results?search_query=` |
|
||||
| `deepl` | `https://www.deepl.com/translator#auto/auto/` |
|
||||
| `dockerhub` | `https://hub.docker.com/search?q=` |
|
||||
|
||||
@@ -24,7 +24,6 @@ function web_search() {
|
||||
wolframalpha "https://www.wolframalpha.com/input/?i="
|
||||
archive "https://web.archive.org/web/*/"
|
||||
scholar "https://scholar.google.com/scholar?q="
|
||||
ask "https://www.ask.com/web?q="
|
||||
youtube "https://www.youtube.com/results?search_query="
|
||||
deepl "https://www.deepl.com/translator#auto/auto/"
|
||||
dockerhub "https://hub.docker.com/search?q="
|
||||
@@ -89,7 +88,6 @@ alias stackoverflow='web_search stackoverflow'
|
||||
alias wolframalpha='web_search wolframalpha'
|
||||
alias archive='web_search archive'
|
||||
alias scholar='web_search scholar'
|
||||
alias ask='web_search ask'
|
||||
alias youtube='web_search youtube'
|
||||
alias deepl='web_search deepl'
|
||||
alias dockerhub='web_search dockerhub'
|
||||
|
||||
@@ -5,12 +5,12 @@ function my_git_prompt() {
|
||||
STATUS=""
|
||||
|
||||
# is branch ahead?
|
||||
if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
if $(echo "$(git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
|
||||
# is branch behind?
|
||||
if $(echo "$(git log HEAD..origin/$(git_current_branch) 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
if $(echo "$(git log HEAD..@{upstream} 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
|
||||
|
||||
+2
-1
@@ -119,12 +119,13 @@ function parse-commit {
|
||||
}
|
||||
|
||||
# Return truncated hash of the reverted commit
|
||||
# (12 characters, to match the commit hashes from `git log --abbrev=12`)
|
||||
function commit:is-revert {
|
||||
local subject="$1" body="$2"
|
||||
|
||||
if [[ "$subject" = Revert* && \
|
||||
"$body" =~ "This reverts commit ([^.]+)\." ]]; then
|
||||
echo "${match[1]:0:7}"
|
||||
echo "${match[1]:0:12}"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -528,6 +528,7 @@ print_success() {
|
||||
"$(fmt_code "$(fmt_link ".zshrc" "file://$zdot/.zshrc" --text)")" \
|
||||
"file to select plugins, themes, and options."
|
||||
printf '\n'
|
||||
printf '%s\n' "${FMT_YELLOW}★${FMT_RESET} Enjoying Oh My Zsh? Star us on $(fmt_link GitHub https://github.com/ohmyzsh/ohmyzsh)"
|
||||
printf '%s\n' "• Follow along on X ($(fmt_link @ohmyzsh https://x.com/ohmyzsh)) or Bluesky ($(fmt_link @ohmyz.sh https://bsky.app/profile/ohmyz.sh))"
|
||||
printf '%s\n' "• Questions or ideas? Join the community on $(fmt_link Discord https://discord.gg/ohmyzsh)"
|
||||
printf '%s\n' "• Help support the project: sponsor us on $(fmt_link "Open Collective" https://opencollective.com/ohmyzsh),"
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# Run with: zsh -df tools/tests/changelog.test.zsh
|
||||
emulate -L zsh
|
||||
setopt err_return
|
||||
|
||||
local changelog="${0:A:h:h}/changelog.sh"
|
||||
local test_dir=$(mktemp -d) original_dir=$PWD
|
||||
|
||||
# Isolate the test repository from the user's git configuration.
|
||||
export GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_NOSYSTEM=1
|
||||
export GIT_AUTHOR_NAME=test GIT_AUTHOR_EMAIL=test@example.com
|
||||
export GIT_COMMITTER_NAME=test GIT_COMMITTER_EMAIL=test@example.com
|
||||
|
||||
# check_changelog <description> <until> <since> <patterns...>
|
||||
# Each pattern must match a line of the output; a leading ! means no line may match it.
|
||||
check_changelog() {
|
||||
local description=$1 until=$2 since=$3 pattern
|
||||
shift 3
|
||||
local -a lines
|
||||
lines=("${(@f)$(zsh -f "$changelog" "$until" "$since" --raw)}")
|
||||
for pattern; do
|
||||
if [[ $pattern = !* ]]; then
|
||||
(( ! ${lines[(I)${~pattern#!}]} )) && continue
|
||||
else
|
||||
(( ${lines[(I)${~pattern}]} )) && continue
|
||||
fi
|
||||
print -u2 -r -- "FAIL: $description (pattern: $pattern)"
|
||||
print -u2 -rl -- $lines
|
||||
return 1
|
||||
done
|
||||
print -r -- "PASS: $description"
|
||||
}
|
||||
|
||||
{
|
||||
builtin cd "$test_dir"
|
||||
command git init -q
|
||||
command git commit -q --allow-empty -m 'chore: initial commit'
|
||||
print demo > demo && command git add demo
|
||||
command git commit -q -m 'feat(demo): add a demo feature'
|
||||
print core > core && command git add core
|
||||
command git commit -q -m 'fix(core): fix an unrelated bug'
|
||||
command git revert --no-edit HEAD~1 >/dev/null
|
||||
|
||||
check_changelog 'hide a reverted commit and its revert' HEAD HEAD~3 \
|
||||
'*Fix an unrelated bug' '!*Add a demo feature' '!*Revert *'
|
||||
|
||||
check_changelog 'keep a revert whose reverted commit is not in the range' HEAD HEAD~2 \
|
||||
'*Fix an unrelated bug' '*Revert "feat\(demo\): add a demo feature"'
|
||||
|
||||
check_changelog 'keep a commit that has not been reverted yet' HEAD~1 HEAD~3 \
|
||||
'*Add a demo feature' '*Fix an unrelated bug'
|
||||
|
||||
print 'All changelog tests passed.'
|
||||
} always {
|
||||
builtin cd "$original_dir"
|
||||
rm -rf -- "$test_dir"
|
||||
}
|
||||
@@ -311,6 +311,9 @@ if perform_update; then
|
||||
printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET
|
||||
printf '\n'
|
||||
printf "${BLUE}%s${RESET}\n\n" "$message"
|
||||
printf "${YELLOW}${BOLD}★${RESET} ${BLUE}${BOLD}%s %s${RESET}\n" \
|
||||
"Enjoying Oh My Zsh? Star us on" \
|
||||
"$(fmt_link GitHub https://github.com/ohmyzsh/ohmyzsh)"
|
||||
printf "${BLUE}${BOLD}%s %s %s %s${RESET}\n" \
|
||||
"Follow along on X" "($(fmt_link @ohmyzsh https://x.com/ohmyzsh))" \
|
||||
"or Bluesky" "($(fmt_link @ohmyz.sh https://bsky.app/profile/ohmyz.sh))"
|
||||
|
||||
Reference in new issue
Block a user