mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-12 18:39:53 +00:00
Compare commits
7 Commits
9e23925b85
...
ddd77516ef
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddd77516ef | ||
|
|
7f3d8a34e2 | ||
|
|
c87eb79140 | ||
|
|
c1e9748909 | ||
|
|
d3888251ac | ||
|
|
34d6932b08 | ||
|
|
2b2d6d746c |
11
.github/workflows/dependencies.yml
vendored
11
.github/workflows/dependencies.yml
vendored
@@ -13,18 +13,23 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
|
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Authenticate as @ohmyzsh
|
- name: Authenticate as @ohmyzsh
|
||||||
id: generate-token
|
id: generate-token
|
||||||
uses: actions/create-github-app-token@v2
|
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
|
||||||
with:
|
with:
|
||||||
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
cache: "pip"
|
cache: "pip"
|
||||||
|
|||||||
14
.github/workflows/installer.yml
vendored
14
.github/workflows/installer.yml
vendored
@@ -25,8 +25,13 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
|
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
- name: Install zsh
|
- name: Install zsh
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: sudo apt-get update; sudo apt-get install zsh
|
run: sudo apt-get update; sudo apt-get install zsh
|
||||||
@@ -41,8 +46,13 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
|
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
- name: Install Vercel CLI
|
- name: Install Vercel CLI
|
||||||
run: npm install -g vercel
|
run: npm install -g vercel
|
||||||
- name: Setup project and deploy
|
- name: Setup project and deploy
|
||||||
|
|||||||
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
@@ -23,8 +23,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
|
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
- name: Install zsh
|
- name: Install zsh
|
||||||
run: sudo apt-get update; sudo apt-get install zsh
|
run: sudo apt-get update; sudo apt-get install zsh
|
||||||
- name: Check syntax
|
- name: Check syntax
|
||||||
|
|||||||
7
.github/workflows/project.yml
vendored
7
.github/workflows/project.yml
vendored
@@ -16,9 +16,14 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
|
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Authenticate as @ohmyzsh
|
- name: Authenticate as @ohmyzsh
|
||||||
id: generate-token
|
id: generate-token
|
||||||
uses: actions/create-github-app-token@v2
|
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
|
||||||
with:
|
with:
|
||||||
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
app-id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||||
|
|||||||
65
.github/workflows/scorecard.yml
vendored
Normal file
65
.github/workflows/scorecard.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||||
|
# by a third-party and are governed by separate terms of service, privacy
|
||||||
|
# policy, and support documentation.
|
||||||
|
|
||||||
|
name: Scorecard supply-chain security
|
||||||
|
on:
|
||||||
|
# For Branch-Protection check. Only the default branch is supported. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||||
|
branch_protection_rule:
|
||||||
|
# To guarantee Maintained check is occasionally updated. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||||
|
schedule:
|
||||||
|
- cron: '20 7 * * 2'
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
# Declare default permissions as read only.
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
name: Scorecard analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# Needed to upload the results to code-scanning dashboard.
|
||||||
|
security-events: write
|
||||||
|
# Needed to publish results and get a badge (see publish_results below).
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
actions: read
|
||||||
|
# To allow GraphQL ListCommits to work
|
||||||
|
issues: read
|
||||||
|
pull-requests: read
|
||||||
|
# To detect SAST tools
|
||||||
|
checks: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
|
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
||||||
|
with:
|
||||||
|
egress-policy: audit
|
||||||
|
|
||||||
|
- name: "Checkout code"
|
||||||
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: "Run analysis"
|
||||||
|
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
publish_results: true
|
||||||
|
|
||||||
|
- name: "Upload artifact"
|
||||||
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
|
with:
|
||||||
|
name: SARIF file
|
||||||
|
path: results.sarif
|
||||||
|
retention-days: 5
|
||||||
|
|
||||||
|
- name: "Upload to code-scanning"
|
||||||
|
uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
||||||
40
lib/cli.zsh
40
lib/cli.zsh
@@ -621,10 +621,48 @@ function _omz::pr::test {
|
|||||||
done
|
done
|
||||||
|
|
||||||
(( $found )) || {
|
(( $found )) || {
|
||||||
_omz::log error "could not found the ohmyzsh git remote. Aborting..."
|
_omz::log error "could not find the ohmyzsh git remote. Aborting..."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if Pull Request has the "testers needed" label
|
||||||
|
_omz::log info "checking if PR #$1 has the 'testers needed' label..."
|
||||||
|
local pr_json label label_id="MDU6TGFiZWw4NzY1NTkwNA=="
|
||||||
|
pr_json=$(
|
||||||
|
curl -fsSL \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
"https://api.github.com/repos/ohmyzsh/ohmyzsh/pulls/$1"
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ $? -gt 0 || -z "$pr_json" ]]; then
|
||||||
|
_omz::log error "error when trying to fetch PR #$1 from GitHub."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the label is present with jq or grep
|
||||||
|
if (( $+commands[jq] )); then
|
||||||
|
label="$(command jq ".labels.[] | select(.node_id == \"$label_id\")" <<< "$pr_json")"
|
||||||
|
else
|
||||||
|
label="$(command grep "\"$label_id\"" <<< "$pr_json" 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If a maintainer hasn't labeled the PR to test, explain the security risk
|
||||||
|
if [[ -z "$label" ]]; then
|
||||||
|
_omz::log warn "PR #$1 does not have the 'testers needed' label. This means that the PR"
|
||||||
|
_omz::log warn "has not been reviewed by a maintainer and may contain malicious code."
|
||||||
|
|
||||||
|
# Ask for explicit confirmation: user needs to type "yes" to continue
|
||||||
|
_omz::log prompt "Do you want to continue testing it? [yes/N] "
|
||||||
|
builtin read -r
|
||||||
|
if [[ "${REPLY:l}" != yes ]]; then
|
||||||
|
_omz::log error "PR test canceled. Please ask a maintainer to review and label the PR."
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
_omz::log warn "Continuing to check out and test PR #$1. Be careful!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Fetch pull request head
|
# Fetch pull request head
|
||||||
_omz::log info "fetching PR #$1 to ohmyzsh/pull-$1..."
|
_omz::log info "fetching PR #$1 to ohmyzsh/pull-$1..."
|
||||||
command git fetch -f "$remote" refs/pull/$1/head:ohmyzsh/pull-$1 || {
|
command git fetch -f "$remote" refs/pull/$1/head:ohmyzsh/pull-$1 || {
|
||||||
|
|||||||
@@ -60,8 +60,10 @@ function bgnotify_formatted {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bgnotify_appid {
|
function bgnotify_appid {
|
||||||
if (( ${+commands[osascript]} )); then
|
if (( ${+commands[lsappinfo]} )); then
|
||||||
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
lsappinfo info -only bundleid "$(lsappinfo front)" | awk -F= '{print $2}' | tr -d '"' 2>/dev/null
|
||||||
|
elif (( ${+commands[osascript]} )); then
|
||||||
|
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
||||||
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
|
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
|
||||||
local app_id=$(bgnotify_find_sway_appid)
|
local app_id=$(bgnotify_find_sway_appid)
|
||||||
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
||||||
@@ -108,6 +110,7 @@ function bgnotify_programid {
|
|||||||
case "$TERM_PROGRAM" in
|
case "$TERM_PROGRAM" in
|
||||||
iTerm.app) echo 'com.googlecode.iterm2' ;;
|
iTerm.app) echo 'com.googlecode.iterm2' ;;
|
||||||
Apple_Terminal) echo 'com.apple.terminal' ;;
|
Apple_Terminal) echo 'com.apple.terminal' ;;
|
||||||
|
ghostty) echo 'com.mitchellh.ghostty' ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
plugins/task/README.md
Normal file
9
plugins/task/README.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Buf plugin
|
||||||
|
|
||||||
|
This plugin adds completion for [Task CLI](https://taskfile.dev/), a fast, cross-platform build tool inspired by Make, designed for modern workflows.
|
||||||
|
|
||||||
|
To use it, add `task` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... task)
|
||||||
|
```
|
||||||
14
plugins/task/task.plugin.zsh
Normal file
14
plugins/task/task.plugin.zsh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Autocompletion for the task CLI (task).
|
||||||
|
if (( !$+commands[task] )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `task`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_task" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _task
|
||||||
|
_comps[task]=_task
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate and load task completion
|
||||||
|
task --completion zsh >! "$ZSH_CACHE_DIR/completions/_task" &|
|
||||||
@@ -13,3 +13,6 @@ plugins=(... tldr)
|
|||||||
| Shortcut | Description |
|
| Shortcut | Description |
|
||||||
|------------------------------------|----------------------------------------------------------------------------|
|
|------------------------------------|----------------------------------------------------------------------------|
|
||||||
| <kbd>Esc</kbd> + tldr | add tldr before the previous command to see the tldr page for this command |
|
| <kbd>Esc</kbd> + tldr | add tldr before the previous command to see the tldr page for this command |
|
||||||
|
|
||||||
|
## Note
|
||||||
|
You also need to install ```tldr```.
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ function handle_update() {
|
|||||||
|
|
||||||
# Ask for confirmation and only update on 'y', 'Y' or Enter
|
# Ask for confirmation and only update on 'y', 'Y' or Enter
|
||||||
# Otherwise just show a reminder for how to update
|
# Otherwise just show a reminder for how to update
|
||||||
echo -n "[oh-my-zsh] Would you like to update? [Y/n] "
|
printf "[oh-my-zsh] Would you like to update? [Y/n] "
|
||||||
read -r -k 1 option
|
read -r -k 1 option
|
||||||
[[ "$option" = $'\n' ]] || echo
|
[[ "$option" = $'\n' ]] || echo
|
||||||
case "$option" in
|
case "$option" in
|
||||||
@@ -280,7 +280,7 @@ case "$update_mode" in
|
|||||||
return 0
|
return 0
|
||||||
elif [[ "$EXIT_STATUS" -ne 0 ]]; then
|
elif [[ "$EXIT_STATUS" -ne 0 ]]; then
|
||||||
print -P "\n%F{red}[oh-my-zsh] There was an error updating:%f"
|
print -P "\n%F{red}[oh-my-zsh] There was an error updating:%f"
|
||||||
printf "\n${fg[yellow]}%s${reset_color}" "$ERROR"
|
printf "\n${fg[yellow]}%s${reset_color}" "${ERROR}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
} always {
|
} always {
|
||||||
|
|||||||
Reference in New Issue
Block a user