Compare commits

..
Author SHA1 Message Date
adf9eeea22 feat(git): add grpa alias for git reset --patch
The counterpart to `gapa` (`git add --patch`): unstage hunks interactively.
Originally proposed in #11295.

Co-authored-by: Carl Nimhed <carl.nimhed@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 18:35:46 -08:00
54 changed files with 123 additions and 6710 deletions

No files matched your search

+15 -51
View File
@@ -1,57 +1,21 @@
<!-- ## Standards checklist:
Thanks for contributing! Read CONTRIBUTING.md first.
Keep this proportional to the change: short paragraphs or bullets are welcome.
Remove these instructions before submitting.
Report only evidence you have. Distinguish agent-run checks from personal <!-- Fill with an x the ones that apply. Example: [x] -->
testing, identify missing checks or demos, and leave unconfirmed items
unchecked. Don't promise follow-up work on someone else's behalf.
-->
## What and why - [ ] The PR title is descriptive.
- [ ] The PR doesn't replicate another PR which is already open.
- [ ] I have read the contribution guide and followed all the instructions.
- [ ] The code follows the code style guide detailed in the wiki.
- [ ] The code is mine or it's from somewhere with an MIT-compatible license.
- [ ] If I used AI tools (ChatGPT, Claude, Gemini, etc.) to assist with this contribution, I've disclosed it below.
- [ ] The code is efficient, to the best of my ability, and does not waste computer resources.
- [ ] The code is stable and I have tested it myself, to the best of my abilities.
- [ ] If the code introduces new aliases, I provide a valid use case for all plugin users down below.
<!-- What changes, who benefits, and how does it make their command-line ## Changes:
experience easier or more delightful? A few sentences are usually enough.
Link related issues or requests if available; don't invent demand.
A personal itch is a welcome starting point. Explain why the change belongs - [...]
in the shared project. For aliases, describe common workflows they support. -->
## Demo and verification ## Other comments:
<!-- For user-facing changes, include before/after screenshots, a GIF, ...
or a short video. For new features, show an example in use.
If a visual isn't useful, briefly explain why. If it's missing, say so.
Describe checks actually run and their results, relevant versions, and
testing gaps. Distinguish agent-run checks from personal testing.
For documentation-only changes, describe what you checked. -->
## Other notes
<!-- Include only what applies:
- Compatibility concerns or areas needing particular attention.
- How users can discover a feature: README update, example, or shared demo.
- Meaningful AI assistance and its role; basic autocomplete doesn't count.
Delete this section if it isn't needed. -->
<details>
<summary>Submission checklist</summary>
<!-- Check confirmed items with [x]. For conditional items, check them if
the condition doesn't apply. Otherwise, mark inapplicable items "N/A"
with a brief reason. -->
- [ ] The PR title follows the [commit conventions](https://github.com/ohmyzsh/ohmyzsh/blob/master/CONTRIBUTING.md#commit-guidelines) and clearly describes the change.
- [ ] I've searched for existing PRs and confirmed this isn't a duplicate.
- [ ] I've read and followed the [contribution guidelines](https://github.com/ohmyzsh/ohmyzsh/blob/master/CONTRIBUTING.md).
- [ ] My code follows the [code style guide](https://github.com/ohmyzsh/ohmyzsh/wiki/Code-Style-Guide).
- [ ] I wrote this code or can contribute it under an MIT-compatible license.
- [ ] If I meaningfully used AI tools, I've disclosed their role above.
- [ ] I've included a visual demonstration or explained why a visual isn't useful.
- [ ] I've considered performance and avoided unnecessary work or resource use.
- [ ] I've personally tested the change and described results and limitations above.
- [ ] If I've added aliases, I've explained their usefulness for common workflows.
</details>
-20
View File
@@ -6,8 +6,6 @@ updates:
interval: "weekly" interval: "weekly"
day: "sunday" day: "sunday"
labels: [] labels: []
cooldown:
default-days: 7
groups: groups:
gha-minor: gha-minor:
patterns: patterns:
@@ -21,8 +19,6 @@ updates:
interval: "weekly" interval: "weekly"
day: "sunday" day: "sunday"
labels: [] labels: []
cooldown:
default-days: 7
groups: groups:
py-minor: py-minor:
patterns: patterns:
@@ -30,19 +26,3 @@ updates:
update-types: update-types:
- minor - minor
- patch - patch
- package-ecosystem: npm
directory: "/.github/workflows/installer"
schedule:
interval: "weekly"
day: "sunday"
labels: []
cooldown:
default-days: 7
groups:
npm-minor:
patterns:
- "*"
update-types:
- major
- minor
- patch
-66
View File
@@ -1,66 +0,0 @@
# Workflow checks
The `Workflow lint` workflow runs jactionlint on pull requests and pushes to
`master`. It checks workflows and Dependabot configuration with the default
profile, including ShellCheck for inline shell scripts. It runs without online
checks or publishing credentials.
To run the same checks locally, install jactionlint 2.6.0 and ShellCheck, then run
from the repository root:
```sh
jactionlint --profile=default --no-online
```
Keep the local jactionlint version aligned with the pinned action in `lint.yml`.
There is no baseline: new findings fail the check. Any rule exception should be
limited to the relevant line and explain why it is needed.
## Action lockfile
`actions.lock` records the commit for every action the workflows use, including
actions called by other actions. Workflows reference release tags; the lockfile
holds the commit that runs. Do not edit it by hand.
After adding a workflow or changing any `uses:` line, regenerate it with the
[`gh actions-lock`](https://github.com/github/gh-actions-lock) extension and
commit the result:
```sh
gh extension install github/gh-actions-lock
gh actions-lock
```
Dependabot updates the lockfile entry in the same pull request when it bumps an
action.
The `Workflow lint` workflow verifies the lockfile on every pull request and
fails when it does not match the workflows.
## Project tracking
`project.yml` intentionally uses `pull_request_target` so the GitHub App can add
fork contributions to the project board. It must not check out or execute PR
code. Project IDs are validated before passing them through step outputs, and
PR-derived plugin/theme names are restricted to letters, digits, dots, underscores
and hyphens.
The App tokens request explicit permissions: project tracking needs organization
projects write access and issues/pull requests read access; dependency updates
need contents read access and issues/pull requests write access. Dependency pushes
use the job's separate `GITHUB_TOKEN` with contents write access.
## Installer deployment
The Vercel CLI is pinned in `installer/package.json` and `installer/package-lock.json`.
Dependabot checks this dependency weekly, with a seven-day cooldown for version
updates, like the other configured ecosystems. Deployment installs the lockfile
with `npm ci --ignore-scripts`; `.vercelignore` uploads only `install.sh`.
After changing the CLI version, update its lockfile and verify the CLI locally:
```sh
npm install --package-lock-only --ignore-scripts --prefix .github/workflows/installer
npm ci --ignore-scripts --prefix .github/workflows/installer
.github/workflows/installer/node_modules/.bin/vercel --version
```
-90
View File
@@ -1,90 +0,0 @@
# This file is machine-generated by `gh actions-lock`.
# Do not edit by hand; run `gh actions-lock` to update.
# Docs: https://gh.io/actions-lockfile
version: 'v0.0.3'
workflows:
'.github/workflows/dependencies.yml':
- 'actions/checkout@v7.0.1'
- 'actions/create-github-app-token@v3.4.0'
- 'actions/setup-python@v7.1.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/installer.yml':
- 'actions/checkout@v7.0.1'
- 'actions/setup-node@v7.1.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/lint.yml':
- 'actions/checkout@v7.0.1'
- 'github/gh-actions-lock@verify/v0.5.1'
- 'jdx/jactionlint@v2.6.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/main.yml':
- 'actions/checkout@v7.0.1'
- 'actions/setup-python@v7.1.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/project.yml':
- 'actions/create-github-app-token@v3.4.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/scorecard.yml':
- 'actions/checkout@v7.0.1'
- 'actions/upload-artifact@v7.0.2'
- 'github/codeql-action@v4.39.5'
- 'ossf/scorecard-action@v2.6.0'
- 'step-security/harden-runner@v2.23.0'
dependencies:
'actions/checkout@v7.0.1':
ref: 'v7.0.1'
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
owner_id: 44036562
repo_id: 197814629
'actions/create-github-app-token@v3.4.0':
ref: 'v3.4.0'
commit: 'sha1-f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc'
owner_id: 44036562
repo_id: 642580244
'actions/setup-node@v7.1.0':
ref: 'v7.1.0'
commit: 'sha1-949feb2413d6458794dcd2491c4babbbce0c15c1'
owner_id: 44036562
repo_id: 189476904
'actions/setup-python@v7.1.0':
ref: 'v7.1.0'
commit: 'sha1-6d4fd22b20465ccc0f7354476588e8df7c9ca0e0'
owner_id: 44036562
repo_id: 192625525
'actions/upload-artifact@v7.0.2':
ref: 'v7.0.2'
commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9'
owner_id: 44036562
repo_id: 192625955
'github/codeql-action@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2':
ref: 'v4.38.2'
commit: 'sha1-2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2'
owner_id: 9919
repo_id: 259445878
'github/codeql-action@v4.39.5':
ref: 'v4.39.5'
commit: 'sha1-915412ff23e8b7659517e607487dbeae018f2934'
owner_id: 9919
repo_id: 259445878
'github/gh-actions-lock@verify/v0.5.1':
ref: 'verify/v0.5.1'
commit: 'sha1-5fa07d19c267d19e29f4341f10fdf7f516375038'
owner_id: 9919
repo_id: 1217640442
'jdx/jactionlint@v2.6.0':
ref: 'v2.6.0'
commit: 'sha1-72c00452809bcca05b8bc12acdcf15dd7a9c1c5e'
owner_id: 216188
repo_id: 1404951382
uses:
- 'github/codeql-action@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2'
'ossf/scorecard-action@v2.6.0':
ref: 'v2.6.0'
commit: 'sha1-23f22cd43608bae7a1f1fa2603d7314dee9538a5'
owner_id: 67707773
repo_id: 421101922
'step-security/harden-runner@v2.23.0':
ref: 'v2.23.0'
commit: 'sha1-aebdcf6156ab6691adf63218240e476564a1ed4c'
owner_id: 88700172
repo_id: 422287306
+4 -8
View File
@@ -11,31 +11,27 @@ jobs:
check: check:
name: Check for updates name: Check for updates
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
permissions: permissions:
contents: write # this is needed to push commits and branches contents: write # this is needed to push commits and branches
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Checkout - name: Checkout
uses: actions/checkout@v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
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@v3.4.0 uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
permission-contents: read
permission-issues: write
permission-pull-requests: write
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v7.1.0 uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with: with:
python-version: "3.12" python-version: "3.12"
cache: "pip" cache: "pip"
@@ -1,7 +1,7 @@
certifi==2026.11.20 certifi==2026.10.23
charset-normalizer==3.5.3 charset-normalizer==3.5.2
idna==3.20 idna==3.20
PyYAML==6.0.4 PyYAML==6.0.3
requests==2.34.2 requests==2.34.2
semver==3.1.3 semver==3.1.2
urllib3==2.8.0 urllib3==2.8.0
+6 -16
View File
@@ -19,7 +19,6 @@ jobs:
name: Test installer name: Test installer
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy: strategy:
matrix: matrix:
os: os:
@@ -27,12 +26,12 @@ jobs:
- macos-latest - macos-latest
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Set up git repository - name: Set up git repository
uses: actions/checkout@v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- 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
@@ -43,28 +42,19 @@ jobs:
name: Deploy installer in install.ohmyz.sh name: Deploy installer in install.ohmyz.sh
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15
environment: vercel environment: vercel
needs: needs:
- test - test
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Checkout - name: Checkout
uses: actions/checkout@v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v7.1.0
with:
node-version: "24"
package-manager-cache: false
- name: Install Vercel CLI - name: Install Vercel CLI
working-directory: .github/workflows/installer run: npm install -g vercel
run: npm ci --ignore-scripts --no-audit --no-fund
- name: Setup project and deploy - name: Setup project and deploy
env: env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
@@ -73,4 +63,4 @@ jobs:
run: | run: |
cp tools/install.sh .github/workflows/installer/install.sh cp tools/install.sh .github/workflows/installer/install.sh
cd .github/workflows/installer cd .github/workflows/installer
./node_modules/.bin/vercel deploy --prod -t "$VERCEL_TOKEN" vc deploy --prod -t "$VERCEL_TOKEN"
-1
View File
@@ -1,2 +1 @@
install.sh install.sh
node_modules/
File diff suppressed because it is too large. Load diff
-7
View File
@@ -1,7 +0,0 @@
{
"name": "ohmyzsh-installer-deploy",
"private": true,
"devDependencies": {
"vercel": "66.6.0"
}
}
-35
View File
@@ -1,35 +0,0 @@
name: Workflow lint
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
jactionlint:
name: Lint GitHub Actions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- name: Lint workflows and Dependabot configuration
uses: jdx/jactionlint@v2.6.0
with:
profile: default
online: "false"
- name: Verify action lockfile
uses: github/gh-actions-lock@verify/v0.5.1
+6 -8
View File
@@ -21,16 +21,15 @@ jobs:
tests: tests:
name: Run tests name: Run tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Set up git repository - name: Set up git repository
uses: actions/checkout@v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- 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
@@ -40,18 +39,17 @@ jobs:
./plugins/*/*.plugin.zsh \ ./plugins/*/*.plugin.zsh \
./plugins/*/_* \ ./plugins/*/_* \
./themes/*.zsh-theme; do ./themes/*.zsh-theme; do
zsh -n "$file" || exit 1 zsh -n "$file" || return 1
done done
collisions: collisions:
name: Check alias collisions name: Check alias collisions
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
steps: steps:
- name: Set up git repository - name: Set up git repository
uses: actions/checkout@v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v7.1.0 uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with: with:
python-version: '3.14' python-version: '3.14'
- name: Install dependencies - name: Install dependencies
@@ -63,7 +61,7 @@ jobs:
cd .github/workflows/alias_collision/ cd .github/workflows/alias_collision/
python -m pytest python -m pytest
- name: Checkout target branch - name: Checkout target branch
uses: actions/checkout@v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
path: ohmyzsh-target-branch path: ohmyzsh-target-branch
ref: master ref: master
+11 -43
View File
@@ -2,8 +2,6 @@ name: Project tracking
on: on:
issues: issues:
types: [opened, reopened] types: [opened, reopened]
# Board updates need an App token for fork PRs; no PR code is checked out or run.
# jactionlint ignore=dangerous-triggers
pull_request_target: pull_request_target:
types: [opened, reopened, synchronize] types: [opened, reopened, synchronize]
@@ -16,35 +14,25 @@ jobs:
add-to-project: add-to-project:
name: Add to project name: Add to project
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh
id: generate-token id: generate-token
uses: actions/create-github-app-token@v3.4.0 uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
permission-organization-projects: write
permission-issues: read
permission-pull-requests: read
- name: Read project data - name: Read project data
id: project
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
ORGANIZATION: ohmyzsh ORGANIZATION: ohmyzsh
PROJECT_NUMBER: "1" PROJECT_NUMBER: "1"
run: | run: |
# Get Project data # Get Project data
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
gh api graphql -f query=' gh api graphql -f query='
query($org: String!, $number: Int!) { query($org: String!, $number: Int!) {
organization(login: $org){ organization(login: $org){
@@ -60,29 +48,19 @@ jobs:
} }
} }
} }
}' -f org="$ORGANIZATION" -F number="$PROJECT_NUMBER" > project_data.json }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
# Parse project data # Parse project data
PROJECT_ID=$(jq -er '.data.organization.projectV2.id' project_data.json) cat >> "$GITHUB_ENV" <<EOF
PLUGIN_FIELD_ID=$(jq -er '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json) PROJECT_ID=$(jq '.data.organization.projectV2.id' project_data.json)
THEME_FIELD_ID=$(jq -er '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json) PLUGIN_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
for id in "$PROJECT_ID" "$PLUGIN_FIELD_ID" "$THEME_FIELD_ID"; do THEME_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
[[ "$id" =~ ^[A-Za-z0-9_=/+-]+$ ]] || exit 1 EOF
done
{
echo "PROJECT_ID=$PROJECT_ID"
echo "PLUGIN_FIELD_ID=$PLUGIN_FIELD_ID"
echo "THEME_FIELD_ID=$THEME_FIELD_ID"
} >> "$GITHUB_OUTPUT"
- name: Add to project - name: Add to project
id: item
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }} ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }}
PROJECT_ID: ${{ steps.project.outputs.PROJECT_ID }}
run: | run: |
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
item_id="$(gh api graphql -f query=' item_id="$(gh api graphql -f query='
mutation($project: ID!, $content: ID!) { mutation($project: ID!, $content: ID!) {
addProjectV2ItemById(input: {projectId: $project, contentId: $content}) { addProjectV2ItemById(input: {projectId: $project, contentId: $content}) {
@@ -91,12 +69,10 @@ jobs:
} }
} }
} }
' -f project="$PROJECT_ID" -f content="$ISSUE_OR_PR_ID" --jq '.data.addProjectV2ItemById.item.id // error("missing project item ID")')" ' -f project="$PROJECT_ID" -f content="$ISSUE_OR_PR_ID" --jq '.data.addProjectV2ItemById.item.id')"
[[ "$item_id" =~ ^[A-Za-z0-9_=/+-]+$ ]] || exit 1 echo "ITEM_ID=$item_id" >> $GITHUB_ENV
echo "ITEM_ID=$item_id" >> "$GITHUB_OUTPUT"
- name: Classify Pull Request - name: Classify Pull Request
id: classify
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
@@ -133,20 +109,12 @@ jobs:
print "THEME=" theme print "THEME=" theme
} }
} }
' >> "$GITHUB_OUTPUT" ' >> "$GITHUB_ENV"
- name: Fill Pull Request fields in project - name: Fill Pull Request fields in project
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
PROJECT_ID: ${{ steps.project.outputs.PROJECT_ID }}
ITEM_ID: ${{ steps.item.outputs.ITEM_ID }}
PLUGIN_FIELD_ID: ${{ steps.project.outputs.PLUGIN_FIELD_ID }}
PLUGIN: ${{ steps.classify.outputs.PLUGIN }}
THEME_FIELD_ID: ${{ steps.project.outputs.THEME_FIELD_ID }}
THEME: ${{ steps.classify.outputs.THEME }}
run: | run: |
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
gh api graphql -f query=' gh api graphql -f query='
mutation ( mutation (
$project: ID! $project: ID!
+7 -12
View File
@@ -14,18 +14,13 @@ on:
push: push:
branches: ["master"] branches: ["master"]
concurrency: # Declare default permissions as read only.
group: ${{ github.workflow }}-${{ github.ref }} permissions: read-all
cancel-in-progress: true
# Permissions are granted only to the analysis job.
permissions: {}
jobs: jobs:
analysis: analysis:
name: Scorecard analysis name: Scorecard analysis
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15
permissions: permissions:
# Needed to upload the results to code-scanning dashboard. # Needed to upload the results to code-scanning dashboard.
security-events: write security-events: write
@@ -41,30 +36,30 @@ jobs:
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with: with:
persist-credentials: false persist-credentials: false
- name: "Run analysis" - name: "Run analysis"
uses: ossf/scorecard-action@v2.6.0 uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with: with:
results_file: results.sarif results_file: results.sarif
results_format: sarif results_format: sarif
publish_results: true publish_results: true
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@v7.0.2 uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
retention-days: 5 retention-days: 5
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v4.39.5 uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with: with:
sarif_file: results.sarif sarif_file: results.sarif
-34
View File
@@ -1,34 +0,0 @@
# Instructions for coding agents
Oh My Zsh is maintained by a small team of volunteers. A person reviews every
pull request, so help the contributor send one that is easy to review.
## Before opening a pull request
1. Read [CONTRIBUTING.md](CONTRIBUTING.md) and follow it.
2. Search open pull requests and issues for the same change. If one exists,
tell the contributor instead of opening a duplicate.
3. Fill in [.github/PULL_REQUEST_TEMPLATE.md](.github/PULL_REQUEST_TEMPLATE.md).
Keep its sections and its checklist.
4. Use the [commit format](CONTRIBUTING.md#commit-guidelines) for commits and
for the pull request title.
## Writing the description
- Report only evidence you have. Don't invent user requests, test results,
or demo links.
- Separate checks you ran from testing the contributor did. Don't claim
personal testing or confirmation on their behalf.
- Leave unconfirmed checklist items unchecked, and name any missing testing
or demo.
- Don't commit the contributor to follow-up work they haven't agreed to.
- Disclose meaningful AI assistance in "Other notes".
- Put file names and paths in backticks so they render as code.
## Keeping the change reviewable
- One purpose per pull request. Keep the diff small, and leave unrelated
files alone.
- Follow the [code style guide](https://github.com/ohmyzsh/ohmyzsh/wiki/Code-Style-Guide).
- The contributor must be able to explain the change. If they can't yet,
explain it to them before the pull request is opened.
-32
View File
@@ -20,7 +20,6 @@ you would make is not already covered.
- [Getting started](#getting-started) - [Getting started](#getting-started)
- [You have a solution](#you-have-a-solution) - [You have a solution](#you-have-a-solution)
- [You have an addition](#you-have-an-addition) - [You have an addition](#you-have-an-addition)
- [Writing your PR description](#writing-your-pr-description)
- [A note on AI-assisted contributions](#a-note-on-ai-assisted-contributions) - [A note on AI-assisted contributions](#a-note-on-ai-assisted-contributions)
- [Use the Search, Luke](#use-the-search-luke) - [Use the Search, Luke](#use-the-search-luke)
- [Commit Guidelines](#commit-guidelines) - [Commit Guidelines](#commit-guidelines)
@@ -127,34 +126,6 @@ Because of this, from now on, we require that new aliases follow these condition
This list is not exhaustive! Please remember that your alias will be in the machines of many people, This list is not exhaustive! Please remember that your alias will be in the machines of many people,
so it should be justified why they should have it. so it should be justified why they should have it.
### Writing your PR description
Use the [PR template](.github/PULL_REQUEST_TEMPLATE.md) to help people understand
the purpose of your change before they reach the submission checklist. Keep answers
short and proportional to the change; a sentence or two per section is often enough.
Oh My Zsh should make the command line more delightful. Tell us whose day your
change makes easier, clearer, or more enjoyable, and how. Scratching your own itch
is a welcome starting point! Your change doesn't need to help everyone, but explain
why it would be useful to others and belongs in the shared project. Link relevant
requests or examples when you have them; otherwise, explain the expected benefit
without claiming demand you haven't seen.
For user-facing changes, include screenshots, a GIF, or a short video showing
before/after behavior. For a new feature, demonstrate it in use. Label the examples,
keep terminal text readable, and remove private information. For low-level or other
non-visual changes, explain why a visual wouldn't be useful. If a demo is needed
but you can't capture it yet, say so rather than marking it inapplicable.
Describe the checks actually run and their results, relevant environment versions,
and any testing gaps. Distinguish automated or agent-run checks from testing you
personally performed. For documentation-only changes, describe what you checked.
Only check the personal-testing item after you've done that testing yourself.
For features and enhancements, tell us how you'll help users discover and use them.
A plugin README update, a usage example, or sharing your demo are good ways to help.
Be clear about what's included in the PR and what's planned for later.
## A note on AI-assisted contributions ## A note on AI-assisted contributions
We'll admit it: AI tools can be pretty helpful for coding tasks, and we're not here to gatekeep how you get your work done. We use these tools ourselves! 🤖 We'll admit it: AI tools can be pretty helpful for coding tasks, and we're not here to gatekeep how you get your work done. We use these tools ourselves! 🤖
@@ -179,9 +150,6 @@ The disclosure helps us know how much guidance to offer. If we're just reviewing
As always, we reserve the right to decline any contribution. PRs that appear to be unreviewed AI output, or code the contributor can't explain, may be closed without extensive feedback. As always, we reserve the right to decline any contribution. PRs that appear to be unreviewed AI output, or code the contributor can't explain, may be closed without extensive feedback.
**For coding agents:** follow [AGENTS.md](AGENTS.md). It covers what to read
before drafting a PR and how to keep the description grounded in evidence.
---- ----
## Use the Search, Luke ## Use the Search, Luke
+1 -2
View File
@@ -562,8 +562,7 @@ omz diagnose
It runs a few quick checks and tells you what to fix — for example, it will warn you when It runs a few quick checks and tells you what to fix — for example, it will warn you when
your locale is not UTF-8, which is a common cause of duplicated characters at the prompt your locale is not UTF-8, which is a common cause of duplicated characters at the prompt
(see the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command)), (see the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command)).
and it validates your `plugins=(...)` list, suggesting the closest name for any plugin it can't find.
For a full report suitable for attaching to a bug report, use `omz_diagnostic_dump`. For a full report suitable for attaching to a bug report, use `omz_diagnostic_dump`.
-50
View File
@@ -190,64 +190,14 @@ function _omz::diagnose {
codeset="$(locale charmap 2>/dev/null)" codeset="$(locale charmap 2>/dev/null)"
fi fi
local ret=0
if [[ "${codeset:l}" = (utf-8|utf8) ]]; then if [[ "${codeset:l}" = (utf-8|utf8) ]]; then
_omz::log info "locale charmap is UTF-8" _omz::log info "locale charmap is UTF-8"
else else
_omz::log warn "your locale is not UTF-8 (charmap: ${codeset:-unknown})" _omz::log warn "your locale is not UTF-8 (charmap: ${codeset:-unknown})"
_omz::log info "non-UTF-8 locales may cause glitches in completions and international characters" _omz::log info "non-UTF-8 locales may cause glitches in completions and international characters"
_omz::log info "consider setting a UTF-8 locale, e.g.: export LANG=C.UTF-8" _omz::log info "consider setting a UTF-8 locale, e.g.: export LANG=C.UTF-8"
ret=1
fi
_omz::diagnose::plugins || ret=1
return $ret
}
function _omz::diagnose::plugins {
# Validate the plugins array: flag entries with no matching plugin folder,
# and suggest the closest plugin name (up to 2 typos) for each one.
setopt localoptions extendedglob
local plugin base distance candidate suggestion found=0
local -a missing
for plugin ($plugins); do
if is_plugin "$ZSH_CUSTOM" "$plugin" || is_plugin "$ZSH" "$plugin"; then
(( ++found ))
continue
fi
missing+=("$plugin")
done
for plugin ($missing); do
suggestion=
# Check both roots at each distance, with custom plugins first for ties.
for distance in 1 2; do
for base in "$ZSH_CUSTOM" "$ZSH"; do
for candidate in \
"$base"/plugins/(#a$distance)${(b)plugin}(#qN-/); do
if is_plugin "$base" "${candidate:t}"; then
suggestion=${candidate:t}
break 3
fi
done
done
done
if [[ -n "$suggestion" ]]; then
_omz::log warn "plugin '$plugin' not found (did you mean '$suggestion'?)" \
omz::diagnose
else
_omz::log warn "plugin '$plugin' not found" omz::diagnose
fi
done
if (( $#missing )); then
_omz::log info "$found of ${#plugins} plugins found" omz::diagnose
return 1 return 1
fi fi
(( $#plugins )) && _omz::log info "all ${#plugins} plugins found" omz::diagnose
return 0
} }
function _omz::help { function _omz::help {
-6
View File
@@ -20,8 +20,6 @@
# #
# Set ZSH_CLIPBOARD_OSC52 to "always" to copy through OSC 52 even if a # Set ZSH_CLIPBOARD_OSC52 to "always" to copy through OSC 52 even if a
# clipboard tool is available, or to "never" to disable the fallback. # clipboard tool is available, or to "never" to disable the fallback.
# OSC 52 copies larger than 100 KB (after base64 encoding) fail with an error,
# since many terminals drop or truncate payloads that size.
# #
# Defines two functions, clipcopy and clippaste, based on the detected platform. # Defines two functions, clipcopy and clippaste, based on the detected platform.
## ##
@@ -62,10 +60,6 @@ function _clipcopy_osc52() {
emulate -L zsh emulate -L zsh
local content local content
content=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n') || return 1 content=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n') || return 1
if (( ${#content} > 100000 )); then
print "clipcopy: too large for OSC 52 (${#content} bytes encoded, limit 100000)" >&2
return 1
fi
print -rn -- $'\e]52;c;'"${content}"$'\e\\' > /dev/tty print -rn -- $'\e]52;c;'"${content}"$'\e\\' > /dev/tty
} }
+4 -4
View File
@@ -237,10 +237,9 @@ function _omz_diag_dump_one_big_text() {
fi fi
builtin echo builtin echo
builtin echo "Zsh compdump files:" builtin echo "Zsh compdump files:"
local dumpfile local dumpfile dumpfiles
local -U dumpfiles command ls -lad $zdotdir/.zcompdump*
dumpfiles=( $zdotdir/.zcompdump*(N) ${ZSH_COMPDUMP:h}/.zcompdump*(N) ) dumpfiles=( $zdotdir/.zcompdump*(N) )
(( $#dumpfiles )) && command ls -lad $dumpfiles
if [[ $verbose -ge 2 ]]; then if [[ $verbose -ge 2 ]]; then
for dumpfile in $dumpfiles; do for dumpfile in $dumpfiles; do
_omz_diag_dump_echo_file_w_header $dumpfile _omz_diag_dump_echo_file_w_header $dumpfile
@@ -351,3 +350,4 @@ function _omz_diag_dump_os_specific_version() {
builtin echo builtin echo
done done
} }
+1 -1
View File
@@ -231,7 +231,7 @@ function omz_urlencode() {
url_str+="$byte" url_str+="$byte"
else else
ord=$(( [##16] #byte )) ord=$(( [##16] #byte ))
url_str+="%${(l:2::0:)ord}" url_str+="%$ord"
fi fi
fi fi
done done
-11
View File
@@ -2,8 +2,6 @@
# P.C. Shyamshankar <sykora@lucentbeing.com> # P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ # Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
autoload -Uz is-at-least
typeset -AHg FX FG BG typeset -AHg FX FG BG
FX=( FX=(
@@ -20,16 +18,7 @@ FX=(
() { () {
setopt localoptions noksharrays setopt localoptions noksharrays
local -a codes fg bg local -a codes fg bg
local code
codes=({000..255}) codes=({000..255})
# ${a:^b} array zipping needs zsh 5.0.6
if ! is-at-least 5.0.6; then
for code in $codes; do
FG[$code]="%{"$'\e'"[38;5;${code}m%}"
BG[$code]="%{"$'\e'"[48;5;${code}m%}"
done
return
fi
fg=( "%{"$'\e'"[38;5;"${^codes}"m%}" ) fg=( "%{"$'\e'"[38;5;"${^codes}"m%}" )
bg=( "%{"$'\e'"[48;5;"${^codes}"m%}" ) bg=( "%{"$'\e'"[48;5;"${^codes}"m%}" )
FG=( ${codes:^fg} ) FG=( ${codes:^fg} )
+4 -11
View File
@@ -154,23 +154,16 @@ esac
# the host name to disambiguate local vs. remote paths. # the host name to disambiguate local vs. remote paths.
function omz_termsupport_cwd { function omz_termsupport_cwd {
setopt localoptions unset setopt localoptions unset
# Percent-encode the host and path names. Encoding forks a subshell each, # Percent-encode the host and path names.
# so keep the result and only redo it when its inputs change.
local cache_key="$HOST:$PWD:${langinfo[CODESET]}:${KONSOLE_PROFILE_NAME:+1}:${KONSOLE_DBUS_SESSION:+1}"
if [[ "$_omz_termsupport_cwd_key" != "$cache_key" ]]; then
local URL_HOST URL_PATH local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P "$HOST")" || return 1 URL_HOST="$(omz_urlencode -P $HOST)" || return 1
URL_PATH="$(omz_urlencode -P "$PWD")" || return 1 URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Konsole errors if the HOST is provided # Konsole errors if the HOST is provided
[[ -z "$KONSOLE_PROFILE_NAME" && -z "$KONSOLE_DBUS_SESSION" ]] || URL_HOST="" [[ -z "$KONSOLE_PROFILE_NAME" && -z "$KONSOLE_DBUS_SESSION" ]] || URL_HOST=""
typeset -g _omz_termsupport_cwd_key="$cache_key"
typeset -g _omz_termsupport_cwd_url="file://${URL_HOST}${URL_PATH}"
fi
# common control sequence (OSC 7) to set current host and path # common control sequence (OSC 7) to set current host and path
printf "\e]7;%s\e\\" "$_omz_termsupport_cwd_url" printf "\e]7;file://%s%s\e\\" "${URL_HOST}" "${URL_PATH}"
} }
# Use a precmd hook instead of a chpwd hook to avoid contaminating output # Use a precmd hook instead of a chpwd hook to avoid contaminating output
+11 -42
View File
@@ -38,47 +38,16 @@
# due to malicious input as a consequence of CVE-2021-45444, which affects # due to malicious input as a consequence of CVE-2021-45444, which affects
# zsh versions from 5.0.3 to 5.8. # zsh versions from 5.0.3 to 5.8.
# #
# The patch is applied when VCS_INFO_formats is first called, since loading autoload -Uz +X regexp-replace VCS_INFO_formats 2>/dev/null || return 0
# and patching it on every startup costs time in shells that never use
# vcs_info. `autoload` doesn't replace an already defined function, so this
# wrapper survives a later `autoload -Uz vcs_info` in a theme or .zshrc, and
# vcs_info's own `autoload -Uz VCS_INFO_formats`.
function _omz_patch_vcs_info_formats {
local formatter
if (( $# )); then
formatter="$1"
else
# Load in a subshell so the wrapper stays installed if loading fails.
formatter="$(
unfunction VCS_INFO_formats 2>/dev/null
autoload -Uz +X VCS_INFO_formats 2>/dev/null || return 1
print -r -- "$functions[VCS_INFO_formats]"
)" || return 1
fi
# We use $tmp here because it's already a local variable in VCS_INFO_formats. # We use $tmp here because it's already a local variable in VCS_INFO_formats
local patch='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"' typeset PATCH='for tmp (base base-name branch misc revision subdir) hook_com[$tmp]="${hook_com[$tmp]//\%/%%}"'
local patch_id=vcs_info-patch-9b9840f2-91e5-4471-af84-9e9a0dc68c1b # Unique string to avoid reapplying the patch if this code gets called twice
local post_backend="VCS_INFO_hook 'post-backend'" typeset PATCH_ID=vcs_info-patch-9b9840f2-91e5-4471-af84-9e9a0dc68c1b
if [[ $formatter != *"$patch_id"* ]]; then # Only patch the VCS_INFO_formats function if not already patched
[[ $formatter == *"$post_backend"* ]] || return 1 if [[ "$functions[VCS_INFO_formats]" != *$PATCH_ID* ]]; then
local replacement=": $patch_id; $patch; $post_backend" regexp-replace 'functions[VCS_INFO_formats]' \
formatter="${formatter//"$post_backend"/$replacement}" "VCS_INFO_hook 'post-backend'" \
fi ': ${PATCH_ID}; ${PATCH}; ${MATCH}'
[[ $formatter != "$functions[VCS_INFO_formats]" ]] || return 0
# Assigning to functions reparses the body. Preserve autoload -U behavior.
setopt localoptions noaliases
functions[VCS_INFO_formats]="$formatter"
}
# An autoload stub counts as not loaded yet, so it gets the wrapper too.
if (( $+functions[VCS_INFO_formats] )) && [[ $functions[VCS_INFO_formats] != 'builtin autoload -X'* ]]; then
# A custom formatter may lack the stock hook call.
_omz_patch_vcs_info_formats "$functions[VCS_INFO_formats]" || true
else
function VCS_INFO_formats {
_omz_patch_vcs_info_formats || return 1
VCS_INFO_formats "$@"
}
fi fi
unset PATCH PATCH_ID
+2 -10
View File
@@ -128,7 +128,7 @@ fi
# Save the location of the current completion dump file. # Save the location of the current completion dump file.
if [[ -z "$ZSH_COMPDUMP" ]]; then if [[ -z "$ZSH_COMPDUMP" ]]; then
ZSH_COMPDUMP="${ZSH_CACHE_DIR}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi fi
# Resolve the commit $ZSH is checked out at into $REPLY by reading the git # Resolve the commit $ZSH is checked out at into $REPLY by reading the git
@@ -232,20 +232,12 @@ fi
if [[ "$ZSH_DISABLE_COMPFIX" != true ]]; then if [[ "$ZSH_DISABLE_COMPFIX" != true ]]; then
source "$ZSH/lib/compfix.zsh" source "$ZSH/lib/compfix.zsh"
# Keep the original search path for the warning because compinit can prune it.
_omz_compfix_fpath=("${fpath[@]}")
# Load only from secure directories # Load only from secure directories
# Reset the flag compinit sets when -i excludes insecure entries # Reset the flag compinit sets when -i excludes insecure entries
unset _comp_secure unset _comp_secure
compinit -i -d "$ZSH_COMPDUMP" compinit -i -d "$ZSH_COMPDUMP"
# If completion insecurities exist, warn the user # If completion insecurities exist, warn the user
if [[ "$_comp_secure" == yes ]]; then [[ "$_comp_secure" == yes ]] && handle_completion_insecurities &|
{
fpath=("${_omz_compfix_fpath[@]}")
handle_completion_insecurities
} &|
fi
unset _omz_compfix_fpath
else else
# If the user wants it, load from all found directories # If the user wants it, load from all found directories
compinit -u -d "$ZSH_COMPDUMP" compinit -u -d "$ZSH_COMPDUMP"
-2
View File
@@ -58,8 +58,6 @@ Running the shortest `gs` shell alias that it found:
![image](https://github.com/ohmyzsh/ohmyzsh/assets/19378/39642750-fb10-4f1a-b7f9-f36789eeb01b) ![image](https://github.com/ohmyzsh/ohmyzsh/assets/19378/39642750-fb10-4f1a-b7f9-f36789eeb01b)
It also looks through aliases you type, suggesting only ones that cover more of the command. With the kubectl plugin, `k get pods` suggests `kgp`, while `kgp` on its own suggests nothing.
### Options ### Options
+2 -13
View File
@@ -65,20 +65,9 @@ alias-finder() {
preexec_alias-finder() { preexec_alias-finder() {
# TODO: Remove backward compatibility (other than zstyle form) # TODO: Remove backward compatibility (other than zstyle form)
zstyle -t ':omz:plugins:alias-finder' autoload || [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]] || return zstyle -t ':omz:plugins:alias-finder' autoload && alias-finder $1 || if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
alias-finder $1
# $3 has aliases expanded, so `k get pods` can suggest `kgp`
local -a words=(${(z)1}) found=(${(f)"$(alias-finder $3)"}) keep
local used=${aliases[$words[1]]} line
# If an alias was typed, only suggest aliases that cover more of the command
if [[ -n "$used" ]]; then
for line in $found; do
(( ${#${(Q)line#*=}} > ${#used} )) && keep+=("$line")
done
found=($keep)
fi fi
(( $#found )) && print -rl -- $found
} }
autoload -U add-zsh-hook autoload -U add-zsh-hook
+7 -33
View File
@@ -103,34 +103,10 @@ upgrades were available. Use `pacman -Que` instead.
| parep | `pacaur -Si` | Display information about a package in the repositories | | parep | `pacaur -Si` | Display information about a package in the repositories |
| pareps | `pacaur -Ss` | Search for packages in the repositories | | pareps | `pacaur -Ss` | Search for packages in the repositories |
| paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases | | paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases |
| paupg | `pacaur -Syu` | Sync with repositories before upgrading all packages (from AUR too) | | paupg | `pacaur -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
| pasu | `pacaur -Syu --noconfirm` | Same as `paupg`, but without confirmation | | pasu | `pacaur -Syua --no-confirm` | Same as `paupg`, but without confirmation |
| upgrade[¹](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages | | upgrade[¹](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages |
#### Paru
| Alias | Command | Description |
|---------|--------------------------------|-------------------------------------------------------------------|
| puclean | `paru -Sc` | Clean out old and unused caches and packages |
| puclr | `paru -Scc` | Remove all files from the cache |
| pufiles | `paru -F` | Search the files database for packages that contain a file |
| puin | `paru -S` | Install packages from the repositories |
| puins | `paru -U` | Install a package from a local file |
| puinsd | `paru -S --asdeps` | Install packages as dependencies of another package |
| puloc | `paru -Qi` | Display information about a package in the local database |
| pulocs | `paru -Qs` | Search for packages in the local database |
| pulst | `paru -Qe` | List installed packages including from AUR (tagged as "local") |
| pumir | `paru -Syy` | Force refresh of all package lists after updating mirrorlist |
| puorph | `paru -Qtd` | List orphaned packages |
| pure | `paru -R` | Remove packages, keeping its settings and dependencies |
| purem | `paru -Rns` | Remove packages, including its settings and unneeded dependencies |
| purep | `paru -Si` | Display information about a package in the repositories |
| pureps | `paru -Ss` | Search for packages in the repositories |
| puupd | `paru -Sy` | Update and refresh local package, ABS and AUR databases |
| puupg | `paru -Syu` | Sync with repositories before upgrading packages |
| pusu | `paru -Syu --noconfirm` | Same as `puupg`, but without confirmation |
| upgrade[¹](#f1) | `paru -Syu` | Sync with repositories before upgrading packages |
#### Trizen #### Trizen
| Alias | Command | Description | | Alias | Command | Description |
@@ -152,7 +128,7 @@ upgrades were available. Use `pacman -Que` instead.
| trreps | `trizen -Ss` | Search for packages in the repositories | | trreps | `trizen -Ss` | Search for packages in the repositories |
| trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases | | trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases |
| trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) | | trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
| trsu | `trizen -Syua --noconfirm` | Same as `trupg`, but without confirmation | | trsu | `trizen -Syua --no-confirm` | Same as `trupg`, but without confirmation |
| upgrade[¹](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages | | upgrade[¹](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages |
#### Yay #### Yay
@@ -176,7 +152,7 @@ upgrades were available. Use `pacman -Que` instead.
| yareps | `yay -Ss` | Search for packages in the repositories | | yareps | `yay -Ss` | Search for packages in the repositories |
| yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases | | yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases |
| yaupg | `yay -Syu` | Sync with repositories before upgrading packages | | yaupg | `yay -Syu` | Sync with repositories before upgrading packages |
| yasu | `yay -Syu --noconfirm` | Same as `yaupg`, but without confirmation | | yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation |
| upgrade[¹](#f1) | `yay -Syu` | Sync with repositories before upgrading packages | | upgrade[¹](#f1) | `yay -Syu` | Sync with repositories before upgrading packages |
--- ---
@@ -187,10 +163,9 @@ whether the package manager is installed, checked in the following order:
1. `yay` 1. `yay`
2. `trizen` 2. `trizen`
3. `paru` 3. `pacaur`
4. `pacaur` 4. `aura`
5. `aura` 5. `pacman`
6. `pacman`
## Contributors ## Contributors
@@ -207,4 +182,3 @@ whether the package manager is installed, checked in the following order:
- Jeff M. Hubbard - jeffmhubbard@gmail.com - Jeff M. Hubbard - jeffmhubbard@gmail.com
- K. Harishankar(harishnkr) - hari2menon1234@gmail.com - K. Harishankar(harishnkr) - hari2menon1234@gmail.com
- WH-2099 - wh2099@outlook.com - WH-2099 - wh2099@outlook.com
- Boris Frenkel - fobos2k@gmail.com
-23
View File
@@ -134,27 +134,6 @@ if (( $+commands[pacaur] )); then
alias paupd="pacaur -Sy" alias paupd="pacaur -Sy"
fi fi
if (( $+commands[paru] )); then
alias puclean='paru -Sc'
alias puclr='paru -Scc'
alias pufiles='paru -F'
alias puin='paru -S'
alias puins='paru -U'
alias puinsd='paru -S --asdeps'
alias puloc='paru -Qi'
alias pulocs='paru -Qs'
alias pulst='paru -Qe'
alias pumir='paru -Syy'
alias puorph='paru -Qtd'
alias pure='paru -R'
alias purem='paru -Rns'
alias purep='paru -Si'
alias pureps='paru -Ss'
alias puupd='paru -Sy'
alias puupg='paru -Syu'
alias pusu='paru -Syu --noconfirm'
fi
if (( $+commands[trizen] )); then if (( $+commands[trizen] )); then
alias trconf='trizen -C' alias trconf='trizen -C'
alias trupg='trizen -Syua' alias trupg='trizen -Syua'
@@ -215,8 +194,6 @@ function upgrade() {
yay -Su yay -Su
elif (( $+commands[trizen] )); then elif (( $+commands[trizen] )); then
trizen -Su trizen -Su
elif (( $+commands[paru] )); then
paru -Su
elif (( $+commands[pacaur] )); then elif (( $+commands[pacaur] )); then
pacaur -Su pacaur -Su
elif (( $+commands[aura] )); then elif (( $+commands[aura] )); then
+2 -25
View File
@@ -1,30 +1,7 @@
## Fossil Plugin ## Fossil Plugin
This plugin adds completion support and prompt for fossil repositories. This plugin adds completion support and prompt for fossil repositories.
The prompt will display the current branch and status been dirty or clean.
To use it, add `fossil` to the plugins array in your .zshrc file:
```zsh
plugins=(... fossil)
``
This plugin provides a prompt function named `fossil_prompt_info` that
will display the current branch and if there are changes (dirty) or not (clean).
### Prompt segments
These variables control how the prompt function looks:
```
ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
ZSH_THEME_FOSSIL_PROMPT_DIRTY="%{$fg_bold[red]%}✖"
ZSH_THEME_FOSSIL_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
```
You can override their values in your .zshrc file, anywhere after the
`source $ZSH/oh-my-zsh.sh` line.
### CONTRIBUTOR ### CONTRIBUTOR
- Jefferson González ([jgmdev](https://github.com/jgmdev))
- Jefferson González ([jgmdev](https://github.com/jgmdev))
+16 -24
View File
@@ -7,10 +7,10 @@ ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})" ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
# Text to display if the branch is dirty # Text to display if the branch is dirty
ZSH_THEME_FOSSIL_PROMPT_DIRTY="%{$fg_bold[red]%}✖" ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
# Text to display if the branch is clean # Text to display if the branch is clean
ZSH_THEME_FOSSIL_PROMPT_CLEAN="%{$fg_bold[green]%}✔" ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
function fossil_prompt_info() { function fossil_prompt_info() {
local branch=$(fossil branch current 2>&1) local branch=$(fossil branch current 2>&1)
@@ -25,35 +25,27 @@ function fossil_prompt_info() {
dirty="$ZSH_THEME_FOSSIL_PROMPT_DIRTY" dirty="$ZSH_THEME_FOSSIL_PROMPT_DIRTY"
fi fi
printf ' %s%s%s%s%s' \ printf '%s %s %s %s %s' \
"$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \ "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
"${branch:gs/%/%%}" \ "${branch:gs/%/%%}" \
"$dirty" \
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \ "$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
"$dirty" \
"%{$reset_color%}" "%{$reset_color%}"
} }
function _fossil_prompt () { function _fossil_prompt () {
# Re-check each time, in case the theme rebuilds its prompt in precmd local current=`echo $PROMPT $RPROMPT | grep fossil`
if [ -z "$_FOSSIL_PROMPT" ] || [[ "$PROMPT$RPROMPT" != *fossil_prompt_info* ]]; then
# Use substitutions to work out what other plugins and themes have if [ "$_FOSSIL_PROMPT" = "" -o "$current" = "" ]; then
# done ahead of us so we don't duplicate their work. local _prompt=${PROMPT}
# local _rprompt=${RPROMPT}
# If $fossil_prompt_info isn't in the prompt strings already but we
# can find $git_prompt_info, put it immediately afterward so that local is_prompt=`echo $PROMPT | grep git`
# one or the other appears in the prompt. We're gambling that you
# aren't in a directory that's a checkout for both a Git repo and a if [ "$is_prompt" = "" ]; then
# Fossil repo. RPROMPT="$_rprompt"'$(fossil_prompt_info)'
# else
# Otherwise, add it to the right prompt, as before. PROMPT="$_prompt"'$(fossil_prompt_info) '
if [ "${PROMPT/fossil_prompt_info//}" = "$PROMPT" ]; then
PROMPT="${PROMPT/git_prompt_info/git_prompt_info)\$(fossil_prompt_info}"
fi
if [ "${RPROMPT/fossil_prompt_info//}" = "$RPROMPT" ]; then
RPROMPT="${RPROMPT/git_prompt_info/git_prompt_info)\$(fossil_prompt_info}"
fi
if [[ "$PROMPT$RPROMPT" != *fossil_prompt_info* ]]; then
RPROMPT+='$(fossil_prompt_info)'
fi fi
_FOSSIL_PROMPT="1" _FOSSIL_PROMPT="1"
-2
View File
@@ -18,5 +18,3 @@ plugin is loaded, which is usually when you start up a new terminal emulator.
The cache is stored at: The cache is stored at:
- `$ZSH_CACHE_DIR/completions/_gh` completions script - `$ZSH_CACHE_DIR/completions/_gh` completions script
If an update fails, the last successfully generated completion script is kept.
+1 -4
View File
@@ -14,8 +14,5 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gh" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gh"
() { zf_mv -f -- =( gh completion --shell zsh ) "$ZSH_CACHE_DIR/completions/_gh"
gh completion --shell zsh >| "$1" && [[ -s "$1" ]] \
&& zf_mv -f -- "$1" "$ZSH_CACHE_DIR/completions/_gh"
} =(:) || return
} &| } &|
+1 -2
View File
@@ -18,8 +18,6 @@ plugins=(... git)
| `g` | `git` | | `g` | `git` |
| `ga` | `git add` | | `ga` | `git add` |
| `gaa` | `git add --all` | | `gaa` | `git add --all` |
| `gan` | `git add --intent-to-add` |
| `ganpa` | `git add --intent-to-add . && git add --patch` |
| `gapa` | `git add --patch` | | `gapa` | `git add --patch` |
| `gau` | `git add --update` | | `gau` | `git add --update` |
| `gav` | `git add --verbose` | | `gav` | `git add --verbose` |
@@ -179,6 +177,7 @@ plugins=(... git)
| `grhh` | `git reset --hard` | | `grhh` | `git reset --hard` |
| `grhk` | `git reset --keep` | | `grhk` | `git reset --keep` |
| `grhs` | `git reset --soft` | | `grhs` | `git reset --soft` |
| `grpa` | `git reset --patch` |
| `gpristine` | `git reset --hard && git clean --force -dfx` | | `gpristine` | `git reset --hard && git clean --force -dfx` |
| `gwipe` | `git reset --hard && git clean --force -df` | | `gwipe` | `git reset --hard && git clean --force -df` |
| `groh` | `git reset origin/$(git_current_branch) --hard` | | `groh` | `git reset origin/$(git_current_branch) --hard` |
+2 -31
View File
@@ -1,34 +1,6 @@
# Git version checking # Git version checking
autoload -Uz is-at-least autoload -Uz is-at-least
# Running `git version` forks on every startup, so cache the result for a day git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
# in $ZSH_CACHE_DIR, keyed on the resolved git binary's path and mtime.
# Run the fallback outside this function so its locals cannot shadow wrapper variables.
() {
# Shell overrides and relative PATH entries can make the command hash
# differ from the Git that Zsh actually runs.
(( $+functions[git] || $+aliases[git] || $+galiases[git] || ${path[(I)(|[^/]*)]} )) && return 1
local cache="$ZSH_CACHE_DIR/git-version" git_path="${commands[git]:+${commands[git]:A}}" key magic
local -a stat lines
# Shims and the macOS developer-tool dispatcher can select a different Git.
[[ "${git_path:t:r}" = 'git' ]] || return 1
[[ "$OSTYPE" == darwin* && "$git_path" = /usr/bin/git ]] && return 1
read -r -k 2 -u 0 magic 2>/dev/null < "$git_path" || return 1
[[ "$magic" = '#!' ]] && return 1
zmodload -F zsh/stat b:zstat && zstat -A stat +mtime -- "$git_path" 2>/dev/null || return 1
key="$git_path $stat[1]"
lines=("$cache"(Nm-1))
(( $#lines )) && lines=("${(@f)$(<"$cache")}")
if [[ "$lines[1]" = "$key" && "$lines[2]" == <->.<->* ]]; then
git_version="$lines[2]"
return 0
fi
git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
[[ ! -w "$ZSH_CACHE_DIR" ]] || print -rl -- "$key" "$git_version" >| "$cache"
return 0
} || git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
# #
# Functions Current # Functions Current
@@ -144,8 +116,6 @@ alias ggpur='ggu'
alias g='git' alias g='git'
alias ga='git add' alias ga='git add'
alias gaa='git add --all' alias gaa='git add --all'
alias gan='git add --intent-to-add'
alias ganpa='git add --intent-to-add . && git add --patch'
alias gapa='git add --patch' alias gapa='git add --patch'
alias gau='git add --update' alias gau='git add --update'
alias gav='git add --verbose' alias gav='git add --verbose'
@@ -408,6 +378,7 @@ alias gru='git reset --'
alias grhh='git reset --hard' alias grhh='git reset --hard'
alias grhk='git reset --keep' alias grhk='git reset --keep'
alias grhs='git reset --soft' alias grhs='git reset --soft'
alias grpa='git reset --patch'
alias gpristine='git reset --hard && git clean --force -dfx' alias gpristine='git reset --hard && git clean --force -dfx'
alias gwipe='git reset --hard && git clean --force -df' alias gwipe='git reset --hard && git clean --force -df'
alias groh='git reset origin/$(git_current_branch) --hard' alias groh='git reset origin/$(git_current_branch) --hard'
-91
View File
@@ -1,91 +0,0 @@
#!/usr/bin/env zsh
emulate -LR zsh
plugin=${1:-${0:A:h:h}/git.plugin.zsh}
plugin=${plugin:A}
(( $+commands[git] )) || { print -u2 'Git is required for this test'; exit 1; }
real_version="${${(As: :)$(command git version)}[3]}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
export ZSH_CACHE_DIR="$test_dir"
cache="$ZSH_CACHE_DIR/git-version"
typeset -i failures=0 tests=0
check() {
local description=$1
shift
(( tests++ ))
if "$@"; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
(( failures++ ))
fi
}
# Each source gets a fresh shell scope while sharing the persistent cache.
probe() (
local mode=$1 expected=$2 version
: > "$test_dir/versions"
autoload -Uz +X is-at-least
functions[_test_is_at_least]=$functions[is-at-least]
is-at-least() {
print -r -- "$2" >> "$test_dir/versions"
_test_is_at_least "$@"
}
compdef() { :; }
case $mode in
function) git() { print -r -- "git version $expected"; } ;;
alias) alias git="print -r -- 'git version $expected'" ;;
esac
source "$plugin"
local -a versions=("${(@f)$(<"$test_dir/versions")}")
(( $#versions == 4 )) || return 1
for version in "$versions[@]"; do
[[ "$version" == "$expected" ]] || return 1
done
if [[ "$expected" == 2.5.0 ]]; then
[[ "$aliases[gpf]" == 'git push --force-with-lease' \
&& "$aliases[gsta]" == 'git stash save' ]] || return 1
fi
)
check 'cold load probes the installed Git' probe binary "$real_version"
if [[ ! -f "$cache" ]]; then
print -u2 'This test requires a native Git executable eligible for caching'
exit 1
fi
key="${${(f)$(<"$cache")}[1]}"
check 'warm load uses the installed version' probe binary "$real_version"
check 'function override bypasses an existing binary cache' probe function 2.5.0
check 'alias override bypasses an existing binary cache' probe alias 2.5.0
check 'shell overrides do not replace the binary cache' probe binary "$real_version"
# A different cached version distinguishes a cache hit from a fresh probe.
print -rl -- "$key" 2.5.0 > "$cache"
check 'valid warm cache avoids a new version probe' probe binary 2.5.0
print -r -- "$key" > "$cache"
check 'missing version line triggers a fresh probe' probe binary "$real_version"
print -rl -- "$key" '' > "$cache"
check 'empty version line triggers a fresh probe' probe binary "$real_version"
print -rl -- "$key" invalid > "$cache"
check 'invalid version line triggers a fresh probe' probe binary "$real_version"
print -rl -- 'different executable' 2.5.0 > "$cache"
check 'different binary key triggers a fresh probe' probe binary "$real_version"
print -rl -- "$key" 2.5.0 > "$cache"
touch -t 200001010000 "$cache"
check 'expired cache triggers a fresh probe' probe binary "$real_version"
rm "$cache"
check 'function override works without a cache' probe function 2.5.0
check 'function override does not write a cache' test ! -e "$cache"
rm -f "$cache"
check 'alias override works without a cache' probe alias 2.5.0
check 'alias override does not write a cache' test ! -e "$cache"
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
-3
View File
@@ -31,8 +31,6 @@ plugins=(... kubectl)
| kdelk | `kubectl delete -k` | Delete all resources defined in a kustomization directory | | kdelk | `kubectl delete -k` | Delete all resources defined in a kustomization directory |
| kge | `kubectl get events --sort-by=".lastTimestamp"` | Get events (sorted by timestamp) | | kge | `kubectl get events --sort-by=".lastTimestamp"` | Get events (sorted by timestamp) |
| kgew | `kubectl get events --watch --sort-by=".lastTimestamp"` | Get events and watch as they occur (sorted by timestamp) | | kgew | `kubectl get events --watch --sort-by=".lastTimestamp"` | Get events and watch as they occur (sorted by timestamp) |
| kg | `kubectl get` | Get one or more resources |
| kd | `kubectl describe` | Describe one or more resources in detail |
| | | **Pod management** | | | | **Pod management** |
| kgp | `kubectl get pods` | List all pods in ps output format | | kgp | `kubectl get pods` | List all pods in ps output format |
| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` | | kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
@@ -115,7 +113,6 @@ plugins=(... kubectl)
| | | **Node management** | | | | **Node management** |
| kgno | `kubectl get nodes` | List the nodes in ps output format | | kgno | `kubectl get nodes` | List the nodes in ps output format |
| kgnosl | `kubectl get nodes --show-labels` | List the nodes in ps output format with labels | | kgnosl | `kubectl get nodes --show-labels` | List the nodes in ps output format with labels |
| kgnow | `kubectl get nodes --watch` | List the nodes, then watch for status changes (e.g. Ready/NotReady, cordoned, added or removed) |
| keno | `kubectl edit node` | Edit nodes resource from the default editor | | keno | `kubectl edit node` | Edit nodes resource from the default editor |
| kdno | `kubectl describe node` | Describe node resource in detail | | kdno | `kubectl describe node` | Describe node resource in detail |
| kdelno | `kubectl delete node` | Delete the node | | kdelno | `kubectl delete node` | Delete the node |
-3
View File
@@ -47,8 +47,6 @@ alias kdelf='kubectl delete -f'
alias kdelk='kubectl delete -k' alias kdelk='kubectl delete -k'
alias kge='kubectl get events --sort-by=".lastTimestamp"' alias kge='kubectl get events --sort-by=".lastTimestamp"'
alias kgew='kubectl get events --sort-by=".lastTimestamp" --watch' alias kgew='kubectl get events --sort-by=".lastTimestamp" --watch'
alias kg='kubectl get'
alias kd='kubectl describe'
# Pod management. # Pod management.
alias kgp='kubectl get pods' alias kgp='kubectl get pods'
@@ -159,7 +157,6 @@ alias kcp='kubectl cp'
# Node Management # Node Management
alias kgno='kubectl get nodes' alias kgno='kubectl get nodes'
alias kgnosl='kubectl get nodes --show-labels' alias kgnosl='kubectl get nodes --show-labels'
alias kgnow='kubectl get nodes --watch'
alias keno='kubectl edit node' alias keno='kubectl edit node'
alias kdno='kubectl describe node' alias kdno='kubectl describe node'
alias kdelno='kubectl delete node' alias kdelno='kubectl delete node'
+3 -3
View File
@@ -28,10 +28,10 @@ lsk() {
# Example # Example
# sqs-send user user.json # sqs-send user user.json
sqs-send(){ sqs-send(){
if [ -z "$1" ] || [ -z "$2" ]; then if [ -z "$1" ]; then
echo "Use: sqs-send <queue> <payload>" >&2 echo "Use: sqs-send <queue> <payload>"
return 1 return 1
fi fi
curl -X POST "http://localhost:4566/000000000000/$1" -d "Action=SendMessage" -d "MessageBody=$(cat "$2")" curl -X POST "http://localhost:4566/000000000000/$1" -d "Action=SendMessage" -d "MessageBody=$(cat $2)"
} }
+1 -3
View File
@@ -9,7 +9,6 @@ plugins=(... macos)
``` ```
## Supported Terminals ## Supported Terminals
- [iTerm](https://iterm.sourceforge.net/) - [iTerm](https://iterm.sourceforge.net/)
- [iTerm2](https://iterm2.com/) - [iTerm2](https://iterm2.com/)
- [Hyper](https://hyper.is/) - [Hyper](https://hyper.is/)
@@ -19,7 +18,7 @@ plugins=(... macos)
## Commands ## Commands
| Command | Description | | Command | Description |
| :------------ | :------------------------------------------------------------- | | :------------ | :------------------------------------------------------- |
| `tab` | Open the current directory in a new tab | | `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally | | `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically | | `vsplit_tab` | Split the current terminal tab vertically |
@@ -37,7 +36,6 @@ plugins=(... macos)
| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on | | `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on |
| `music` | Control Apple Music. Use `music -h` for usage details | | `music` | Control Apple Music. Use `music -h` for usage details |
| `spotify` | Control Spotify and search by artist, album, track… | | `spotify` | Control Spotify and search by artist, album, track… |
| `lpm` | Toggle Low Power Mode. Use `lpm on\|off\|status` (macOS 12.0+) |
| `rmdsstore` | Remove .DS_Store files recursively in a directory | | `rmdsstore` | Remove .DS_Store files recursively in a directory |
| `btrestart` | Restart the Bluetooth daemon | | `btrestart` | Restart the Bluetooth daemon |
| `freespace` | Erases purgeable disk space with 0s on the selected disk | | `freespace` | Erases purgeable disk space with 0s on the selected disk |
-47
View File
@@ -1,47 +0,0 @@
function lpm() {
local sw_vers=$(sw_vers -productVersion 2>/dev/null)
autoload is-at-least
if [[ -z "$sw_vers" ]] || ! is-at-least 12.0 $sw_vers; then
echo "Error: Low Power Mode requires macOS 12.0 (Monterey) or later" >&2
echo "Current version: ${sw_vers:-unknown}" >&2
return 1
fi
local lpm_status
case "${1:-toggle}" in
on)
sudo pmset -a lowpowermode 1
;;
off)
sudo pmset -a lowpowermode 0
;;
status)
lpm_status=$(pmset -g | awk '/lowpowermode/ {print $2}')
if [[ "$lpm_status" == "1" ]]; then
echo "enabled"
elif [[ "$lpm_status" == "0" ]]; then
echo "disabled"
else
echo "unknown" >&2
return 3
fi
;;
toggle)
lpm_status=$(pmset -g | awk '/lowpowermode/ {print $2}')
if [[ "$lpm_status" == "1" ]]; then
sudo pmset -a lowpowermode 0
elif [[ "$lpm_status" == "0" ]]; then
sudo pmset -a lowpowermode 1
else
echo "Unable to determine current status to toggle" >&2
return 3
fi
;;
*)
echo "usage: lpm [on|off|status|toggle]" >&2
return 2
;;
esac
}
-3
View File
@@ -314,6 +314,3 @@ source "${0:h:A}/music"
# Spotify control function # Spotify control function
source "${0:h:A}/spotify" source "${0:h:A}/spotify"
# low power mode toggle-switch function
source "${0:h:A}/lpm"
+1 -1
View File
@@ -110,7 +110,7 @@ EOF
echo "\tlaunch|play|pause|stop|rewind|resume|quit" echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tMute or unmute $APP_NAME" echo "\tmute|unmute\tMute or unmute $APP_NAME"
echo "\tnext|previous\tPlay next or previous track" echo "\tnext|previous\tPlay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle." echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume." echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
echo "\tplaying|status\tShow what song is currently playing in Music." echo "\tplaying|status\tShow what song is currently playing in Music."
echo "\tplaylist [playlist name]\t Play specific playlist" echo "\tplaylist [playlist name]\t Play specific playlist"
-10
View File
@@ -50,16 +50,6 @@ function _omz_nvm_setup_autoload {
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent" zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
if [[ -n "$nvmrc_path" ]]; then if [[ -n "$nvmrc_path" ]]; then
# Skip version resolution when an exact, unaliased version is already active.
local nvmrc_version="$(<"$nvmrc_path")"
if [[ "$nvmrc_version" == v<->.<->.<-> \
&& ! -e "$NVM_DIR/alias/$nvmrc_version" \
&& "${commands[node]-}" == "$NVM_DIR/versions/node/$nvmrc_version/bin/node" \
&& -x "${commands[node]-}" ]] \
&& (( ! $+functions[node] && ! $+aliases[node] )) \
&& [[ "$nvmrc_version" == "$(command node --version 2>/dev/null)" ]]; then
return
fi
local nvmrc_node_version=$(nvm version $(command cat "$nvmrc_path" | tr -dc '[:print:]')) local nvmrc_node_version=$(nvm version $(command cat "$nvmrc_path" | tr -dc '[:print:]'))
if [[ "$nvmrc_node_version" = "N/A" ]]; then if [[ "$nvmrc_node_version" = "N/A" ]]; then
-16
View File
@@ -1,16 +0,0 @@
# Ollama
This plugin adds completion for [Ollama](https://ollama.com), the tool for running large language models locally.
To use it, add `ollama` to the plugins array in your zshrc file:
```zsh
plugins=(... ollama)
```
It completes `ollama` subcommands, their flags, and model names (from `ollama list`, or `ollama ps` for `ollama stop`).
## Credits
Adapted from [Grégoire Compagnon's gist](https://gist.github.com/obeone/9313811fd61a7cbb843e0001a4434c58)
by [Konstantin Gredeskoul](https://github.com/kigster).
-123
View File
@@ -1,123 +0,0 @@
#compdef ollama
# Based on https://gist.github.com/obeone/9313811fd61a7cbb843e0001a4434c58 by Grégoire Compagnon (@obeone),
# adapted for Oh My Zsh by Konstantin Gredeskoul (@kigster)
# Complete model names from 'ollama list', or running models from 'ollama ps'
__ollama_models_from() {
local -a models
local output="$(ollama $1 2>/dev/null | sed 's/:/\\:/g')" # escape colons for _describe
if [[ -z "$output" ]]; then
_message "no models available or 'ollama $1' failed"
return 1
fi
models=("${(@f)$(echo "$output" | awk 'NR>1 {print $1}')}")
if [[ ${#models} -eq 0 ]]; then
_message "no models found"
return 1
fi
_describe 'model names' models
}
_ollama_models() { __ollama_models_from list }
_ollama_running_models() { __ollama_models_from ps }
_ollama() {
local -a commands
_arguments -C \
'(- *)'{-v,--version}'[Show version information]' \
'1: :->command' \
'*:: :->args'
commands=(
'serve:Start ollama'
'start:Start ollama (alias for serve)'
'create:Create a model'
'show:Show information for a model'
'run:Run a model'
'stop:Stop a running model'
'pull:Pull a model from a registry'
'push:Push a model to a registry'
'signin:Sign in to ollama.com'
'signout:Sign out from ollama.com'
'login:Sign in to ollama.com (alias for signin)'
'logout:Sign out from ollama.com (alias for signout)'
'list:List models'
'ls:List models (alias for list)'
'ps:List running models'
'cp:Copy a model'
'rm:Remove a model'
'launch:Launch an integration with ollama'
'help:Help about any command'
)
case $state in
command)
_describe -t commands 'ollama command' commands
;;
args)
case $words[1] in
create)
_arguments \
'(-f --file)'{-f+,--file=}'[Name of the Modelfile]:file:_files' \
'(-q --quantize)'{-q+,--quantize=}'[Quantize model to this level]:level:' \
'--force[Continue local creation when validation fails]' \
'1:model name:'
;;
show)
_arguments \
'--license[Show license of a model]' \
'--modelfile[Show Modelfile of a model]' \
'--parameters[Show parameters of a model]' \
'--system[Show system message of a model]' \
'--template[Show template of a model]' \
'(-v --verbose)'{-v,--verbose}'[Show detailed model information]' \
'1:model:_ollama_models'
;;
run)
_arguments \
'--format=[Response format]:format:(json)' \
'--keepalive=[Duration to keep a model loaded]:duration:' \
'--think=[Enable thinking mode]:level:(true false high medium low)' \
'--hidethinking[Hide thinking output]' \
'--truncate[Truncate embedding inputs exceeding context length]' \
'--dimensions=[Truncate output embeddings to this dimension]:dimensions:' \
'--insecure[Use an insecure registry]' \
'--nowordwrap[Disable word wrap]' \
'--verbose[Show timings for response]' \
'1:model:_ollama_models' \
'2:prompt:'
;;
stop)
_arguments '1:running model:_ollama_running_models'
;;
pull|push)
_arguments \
'--insecure[Use an insecure registry]' \
'1:model:_ollama_models'
;;
cp)
_arguments \
'1:source model:_ollama_models' \
'2:target model:'
;;
rm)
_arguments '*:model:_ollama_models'
;;
launch)
_arguments \
'(-m --model)'{-m+,--model=}'[Model to use]:model:_ollama_models' \
'--config[Configure the integration without launching it]' \
'--restore[Restore the integration configuration]' \
'(-y --yes)'{-y,--yes}'[Skip confirmation prompts]' \
'1:integration:'
;;
help)
_describe -t commands 'ollama command' commands
;;
esac
;;
esac
}
_ollama "$@"
-1
View File
@@ -1 +0,0 @@
# Completion for ollama lives in _ollama, which Oh My Zsh adds to fpath
-20
View File
@@ -1,20 +0,0 @@
# sprite plugin
This plugin adds completion for the [Sprites CLI](https://docs.sprites.dev/cli/installation) (`sprite`).
To use it, add `sprite` to the plugins array in your zshrc file:
```zsh
plugins=(... sprite)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH_CACHE_DIR/completions/_sprite` completions script
-17
View File
@@ -1,17 +0,0 @@
# Autocompletion for sprite
if (( ! $+commands[sprite] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `sprite`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_sprite" ]]; then
typeset -g -A _comps
autoload -Uz _sprite
_comps[sprite]=_sprite
fi
() {
local tmpfile="$ZSH_CACHE_DIR/completions/_sprite.$$.tmp"
sprite completion zsh >| "$tmpfile" 2>/dev/null && command mv -f "$tmpfile" "$ZSH_CACHE_DIR/completions/_sprite" || command rm -f "$tmpfile"
} &|
+8 -8
View File
@@ -153,34 +153,34 @@ function port_pro() {
# top10 of gain access to the ip address # top10 of gain access to the ip address
function accessip10() { function accessip10() {
awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog "$1")" awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)"
} }
# top20 of Most Visited file or page # top20 of Most Visited file or page
function visitpage20() { function visitpage20() {
awk '{print $11}' "$(retlog "$1")" | sort | uniq -c | sort -nr | head -n 20 awk '{print $11}' "$(retlog)" | sort | uniq -c | sort -nr | head -n 20
} }
# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences
function consume100() { function consume100() {
awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog "$1")" | sort -n | uniq -c | sort -nr | head -n 100 awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100
# if django website or other website make by no suffix language # if django website or other website make by no suffix language
# awk '{print $7}' "$(retlog "$1")" | sort -n | uniq -c | sort -nr | head -n 100 # awk '{print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100
} }
# Website traffic statistics (G) # Website traffic statistics (G)
function webtraffic() { function webtraffic() {
awk '{sum+=$10} END {print sum/1024/1024/1024}' "$(retlog "$1")" awk '{sum+=$10} END {print sum/1024/1024/1024}' "$(retlog)"
} }
# Statistical connections 404 # Statistical connections 404
function c404() { function c404() {
awk '($9 ~ /404/)' "$(retlog "$1")" | awk '{print $9,$7}' | sort awk '($9 ~ /404/)' "$(retlog)" | awk '{print $9,$7}' | sort
} }
# Statistical http status. # Statistical http status.
function httpstatus() { function httpstatus() {
awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog "$1")" awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)"
} }
# Delete 0 byte file # Delete 0 byte file
@@ -211,5 +211,5 @@ function getip() {
# Second concurrent # Second concurrent
function conssec() { function conssec() {
awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog "$1")" | sort -k 2 -nr | head -n10 awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)" | sort -k 2 -nr | head -n10
} }
-8
View File
@@ -12,14 +12,6 @@ plugins=(... terraform)
## Requirements ## Requirements
- [Terraform](https://terraform.io/) - [Terraform](https://terraform.io/)
- [terraform-docs](https://terraform-docs.io/) (optional, for completion)
## terraform-docs completion
If `terraform-docs` is installed, this plugin also enables its completion.
The completion script is generated from the installed version and cached in
`$ZSH_CACHE_DIR/completions/_terraform-docs`. It is refreshed in the background
each time the plugin loads, so completion stays in sync with the installed CLI.
## Aliases ## Aliases
-20
View File
@@ -39,23 +39,3 @@ alias tfsh='terraform show'
alias tfw='terraform workspace' alias tfw='terraform workspace'
alias tfwl='terraform workspace list' alias tfwl='terraform workspace list'
alias tfws='terraform workspace select' alias tfws='terraform workspace select'
if (( $+commands[terraform-docs] )); then
# If the completion file doesn't exist yet, compinit hasn't registered it.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_terraform-docs" ]]; then
typeset -g -A _comps
autoload -Uz _terraform-docs
_comps[terraform-docs]=_terraform-docs
fi
zmodload -F zsh/files b:zf_mv
() {
local completions
completions=$(command terraform-docs completion zsh) || return
[[ -n "$completions" ]] || return
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._terraform-docs"
zf_mv -f -- =(print -r -- "$completions") \
"$ZSH_CACHE_DIR/completions/_terraform-docs"
} &|
fi
-2
View File
@@ -4,9 +4,7 @@
To use it, add thefuck to the plugins array of your zshrc file: To use it, add thefuck to the plugins array of your zshrc file:
```zsh
plugins=(... thefuck) plugins=(... thefuck)
```
## Usage ## Usage
Press `ESC` twice to correct previous console command. Press `ESC` twice to correct previous console command.
+3 -23
View File
@@ -43,32 +43,12 @@ function _vi-mode-set-cursor-shape-for-keymap() {
printf $'\e[%d q' "${_shape}" printf $'\e[%d q' "${_shape}"
} }
autoload -Uz is-at-least function _visual-mode {
if is-at-least 5.3; then
# Visual mode doesn't change $KEYMAP, it only activates the region, so
# zle-keymap-select never runs when it starts or ends
function _vi-mode-zle-line-pre-redraw() {
if [[ "$KEYMAP" = vicmd ]] && (( REGION_ACTIVE )); then
[[ "$VI_KEYMAP" != visual ]] || return 0
typeset -g VI_KEYMAP=visual
elif [[ "$VI_KEYMAP" = visual ]]; then
typeset -g VI_KEYMAP=$KEYMAP
else
return 0
fi
_vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP"
}
autoload -Uz add-zle-hook-widget
add-zle-hook-widget zle-line-pre-redraw _vi-mode-zle-line-pre-redraw
else
# zle-line-pre-redraw needs zsh 5.3
function _visual-mode {
typeset -g VI_KEYMAP=visual typeset -g VI_KEYMAP=visual
_vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP" _vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP"
zle .visual-mode zle .visual-mode
} }
zle -N visual-mode _visual-mode zle -N visual-mode _visual-mode
fi
function _vi-mode-should-reset-prompt() { function _vi-mode-should-reset-prompt() {
# If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset (default), dynamically # If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset (default), dynamically