mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-25 01:47:25 +08:00
Compare commits
7 Commits
932c02c925
...
9de3607790
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9de3607790 | ||
|
|
72acd2ca90 | ||
|
|
ddec79ad43 | ||
|
|
0ebeae78d0 | ||
|
|
3b66f643e4 | ||
|
|
953f526dea | ||
|
|
4a044ac036 |
6
.github/workflows/dependencies.yml
vendored
6
.github/workflows/dependencies.yml
vendored
@ -13,17 +13,17 @@ jobs:
|
|||||||
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@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.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@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
|
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||||
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 }}
|
||||||
|
|||||||
8
.github/workflows/installer.yml
vendored
8
.github/workflows/installer.yml
vendored
@ -26,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@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.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
|
||||||
@ -47,12 +47,12 @@ jobs:
|
|||||||
- 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@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
- 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
|
||||||
|
|||||||
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@ -24,12 +24,12 @@ jobs:
|
|||||||
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@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.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
|
||||||
|
|||||||
4
.github/workflows/project.yml
vendored
4
.github/workflows/project.yml
vendored
@ -17,12 +17,12 @@ jobs:
|
|||||||
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@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||||
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@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
|
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||||
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 }}
|
||||||
|
|||||||
6
.github/workflows/scorecard.yml
vendored
6
.github/workflows/scorecard.yml
vendored
@ -36,12 +36,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
|
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: "Checkout code"
|
- name: "Checkout code"
|
||||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@ -60,6 +60,6 @@ jobs:
|
|||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
|
uses: github/codeql-action/upload-sarif@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v4.31.7
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
|||||||
18
plugins/ollama/README.md
Normal file
18
plugins/ollama/README.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Ollama
|
||||||
|
|
||||||
|
This plugin provides command completion for Ollama executable.
|
||||||
|
|
||||||
|
It has been adapted from the [Grégoire Compagnon's gist on Github](https://gist.github.com/obeone/9313811fd61a7cbb843e0001a4434c58#file-readme-md):
|
||||||
|
|
||||||
|
It should work out the box if you add it to the plugins array.
|
||||||
|
|
||||||
|
## Port to oh-my-zsh
|
||||||
|
|
||||||
|
© Konstantin Gredeskoul
|
||||||
|
|
||||||
|
A very simple port was made by...
|
||||||
|
|
||||||
|
* [https://kig.re](Konstantin's Blog @ https://kig.re)
|
||||||
|
* [https://github.com/kigster](Konstantin's Github Page)
|
||||||
|
|
||||||
|
And distributede under the same license as oh-my-zsh.
|
||||||
1
plugins/ollama/_ollama
Symbolic link
1
plugins/ollama/_ollama
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
ollama.plugin.zsh
|
||||||
138
plugins/ollama/ollama.plugin.zsh
Normal file
138
plugins/ollama/ollama.plugin.zsh
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
#compdef ollama
|
||||||
|
|
||||||
|
# Acknowledgements: Grégoire Compagnon (https://github.com/obeone)
|
||||||
|
# © 2025 https://gist.github.com/obeone/9313811fd61a7cbb843e0001a4434c58
|
||||||
|
# Adopted for ohmyzsh by Konstantni Gredeskoul (https://kig.re)
|
||||||
|
|
||||||
|
# Purpose:
|
||||||
|
# This script file `_ollama` should be placed in your fpath to provide zsh completions functionality for ollama commands.
|
||||||
|
# It utilizes zsh's native completion system by defining specific completion behaviors tailored to ollama commands.
|
||||||
|
|
||||||
|
# Installation:
|
||||||
|
# 1. Check your current fpath by executing: `echo $fpath` in your zsh shell.
|
||||||
|
# 2. To introduce a new directory to fpath, edit your .zshrc file:
|
||||||
|
# Example: `fpath=($HOME/.zsh-completions $fpath)`
|
||||||
|
# 3. Store this script file in the directory you have added to your fpath.
|
||||||
|
# 4. For a system-wide installation on Linux:
|
||||||
|
# Download and deploy this script with the following command:
|
||||||
|
# sudo wget -O /usr/share/zsh/site-functions/_ollama https://gist.githubusercontent.com/obeone/9313811fd61a7cbb843e0001a4434c58/raw/_ollama.zsh
|
||||||
|
|
||||||
|
# Contributions:
|
||||||
|
# Principal contributions by:
|
||||||
|
# - ChatGPT [ZSH Expert](https://chatgpt.com/g/g-XczdbjXSW-zsh-expert) as the primary creator.
|
||||||
|
# - Guidance and revisions by [obeone](https://github.com/obeone).
|
||||||
|
|
||||||
|
# Note:
|
||||||
|
# - This configuration file presupposes the utilization of Zsh as your primary shell environment.
|
||||||
|
# - It is crucial to restart your zsh session subsequent to alterations made to your fpath to ensure the updates are effectively recognized.
|
||||||
|
|
||||||
|
# Function to fetch and return model names from 'ollama list'
|
||||||
|
_fetch_ollama_models() {
|
||||||
|
local -a models
|
||||||
|
local output="$(ollama list 2>/dev/null | sed 's/:/\\:/g')" # Escape semicolons for zsh
|
||||||
|
if [[ -z "$output" ]]; then
|
||||||
|
_message "no models available or 'ollama list' 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
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main completion function
|
||||||
|
_ollama() {
|
||||||
|
local -a commands
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
'1: :->command' \
|
||||||
|
'*:: :->args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
command)
|
||||||
|
commands=(
|
||||||
|
'serve:Start ollama'
|
||||||
|
'create:Create a model from a Modelfile'
|
||||||
|
'show:Show information for a model'
|
||||||
|
'run:Run a model'
|
||||||
|
'pull:Pull a model from a registry'
|
||||||
|
'push:Push a model to a registry'
|
||||||
|
'list:List models'
|
||||||
|
'cp:Copy a model'
|
||||||
|
'rm:Remove a model'
|
||||||
|
'help:Help about any command'
|
||||||
|
)
|
||||||
|
_describe -t commands 'ollama command' commands
|
||||||
|
;;
|
||||||
|
args)
|
||||||
|
case $words[1] in
|
||||||
|
serve)
|
||||||
|
_arguments \
|
||||||
|
'--host[Specify the host and port]:host and port:' \
|
||||||
|
'--origins[Set allowed origins]:origins:' \
|
||||||
|
'--models[Path to the models directory]:path:_directories' \
|
||||||
|
'--keep-alive[Duration to keep models in memory]:duration:'
|
||||||
|
;;
|
||||||
|
create)
|
||||||
|
_arguments \
|
||||||
|
'-f+[Specify the file name]:file:_files'
|
||||||
|
;;
|
||||||
|
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]' \
|
||||||
|
'*::model:->model'
|
||||||
|
if [[ $state == model ]]; then
|
||||||
|
_fetch_ollama_models
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
run)
|
||||||
|
_arguments \
|
||||||
|
'--format[Specify the response format]:format:' \
|
||||||
|
'--insecure[Use an insecure registry]' \
|
||||||
|
'--nowordwrap[Disable word wrap]' \
|
||||||
|
'--verbose[Show verbose output]' \
|
||||||
|
'*::model and prompt:->model_and_prompt'
|
||||||
|
if [[ $state == model_and_prompt ]]; then
|
||||||
|
_fetch_ollama_models
|
||||||
|
_message "enter prompt"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
pull|push)
|
||||||
|
_arguments \
|
||||||
|
'--insecure[Use an insecure registry]' \
|
||||||
|
'*::model:->model'
|
||||||
|
if [[ $state == model ]]; then
|
||||||
|
_fetch_ollama_models
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
list)
|
||||||
|
_message "no additional arguments for list"
|
||||||
|
;;
|
||||||
|
cp)
|
||||||
|
_arguments \
|
||||||
|
'1:source model:_fetch_ollama_models' \
|
||||||
|
'2:target model:_fetch_ollama_models'
|
||||||
|
;;
|
||||||
|
rm)
|
||||||
|
_arguments \
|
||||||
|
'*::models:->models'
|
||||||
|
if [[ $state == models ]]; then
|
||||||
|
_fetch_ollama_models
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
help)
|
||||||
|
_message "no additional arguments for help"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
mydir=${0:a:h}
|
||||||
|
fpath=(${mydir} $fpath)
|
||||||
@ -1,6 +1,7 @@
|
|||||||
# uv plugin
|
# uv plugin
|
||||||
|
|
||||||
This plugin automatically installs [uv](https://github.com/astral-sh/uv)'s completions for you, and keeps them up to date. It also adds convenient aliases for common usage.
|
This plugin automatically installs [uv](https://github.com/astral-sh/uv)'s completions for you,
|
||||||
|
and keeps them up to date. It also adds convenient aliases for common usage.
|
||||||
|
|
||||||
To use it, add `uv` to the plugins array in your zshrc file:
|
To use it, add `uv` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
@ -10,20 +11,26 @@ plugins=(... uv)
|
|||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|:----- |------------------------------------------------------------------------ |:-------------------------------------------------------------------- |
|
| :---- | ---------------------------------------------------------------------------------------- | :-------------------------------------------------------------------- |
|
||||||
| uva | `uv add` | Add packages to the project |
|
| uva | `uv add` | Add packages to the project |
|
||||||
| uvexp | `uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet` | Export the lock file to `requirements.txt` |
|
| uvexp | `uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet` | Export the lock file to `requirements.txt` |
|
||||||
| uvl | `uv lock` | Lock the dependencies |
|
| uvi | `uv init` | Initialize a new project in current workspace and environment. |
|
||||||
| uvlr | `uv lock --refresh` | Rebuild the lock file without upgrading dependencies |
|
| uvinw | `uv init --no-workspace` | Initialize a new project in a new workspace and environment |
|
||||||
| uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions |
|
| uvl | `uv lock` | Lock the dependencies |
|
||||||
| uvp | `uv pip` | Manage pip packages |
|
| uvlr | `uv lock --refresh` | Rebuild the lock file without upgrading dependencies |
|
||||||
| uvpy | `uv python` | Manage Python installs |
|
| uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions |
|
||||||
| uvpp | `uv python pin` | Pin the current project to use a specific Python version |
|
| uvp | `uv pip` | Manage pip packages |
|
||||||
| uvr | `uv run` | Run commands within the project's environment |
|
| uvpi | `uv python install` | Install a specific version of python |
|
||||||
| uvrm | `uv remove` | Remove packages from the project |
|
| uvpl | `uv python list` | Lists all python version installed |
|
||||||
| uvs | `uv sync` | Sync the environment with the lock file |
|
| uvpp | `uv python pin` | Pin the current project to use a specific Python version |
|
||||||
| uvsr | `uv sync --refresh` | "Force" sync the environment with the lock file (ignore cache) |
|
| uvpu | `uv python uninstall` | Remove a specific version of python |
|
||||||
| uvsu | `uv sync --upgrade` | Sync the environment, allowing upgrades and ignoring the lock file |
|
| uvpy | `uv python` | Manage Python installs |
|
||||||
| uvup | `uv self update` | Update the UV tool to the latest version |
|
| uvr | `uv run` | Run commands within the project's environment |
|
||||||
| uvv | `uv venv` | Manage virtual environments |
|
| uvrm | `uv remove` | Remove packages from the project |
|
||||||
|
| uvs | `uv sync` | Sync the environment with the lock file |
|
||||||
|
| uvsr | `uv sync --refresh` | "Force" sync the environment with the lock file (ignore cache) |
|
||||||
|
| uvsu | `uv sync --upgrade` | Sync the environment, allowing upgrades and ignoring the lock file |
|
||||||
|
| uvtr | `uv tree` | Displays the full dependency tree for the current project environment |
|
||||||
|
| uvup | `uv self update` | Update the UV tool to the latest version |
|
||||||
|
| uvv | `uv venv` | Manage virtual environments |
|
||||||
|
|||||||
@ -7,10 +7,15 @@ alias uv="noglob uv"
|
|||||||
|
|
||||||
alias uva='uv add'
|
alias uva='uv add'
|
||||||
alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet'
|
alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet'
|
||||||
|
alias uvi='uv init'
|
||||||
|
alias uvinw='uv init --no-workspace'
|
||||||
alias uvl='uv lock'
|
alias uvl='uv lock'
|
||||||
alias uvlr='uv lock --refresh'
|
alias uvlr='uv lock --refresh'
|
||||||
alias uvlu='uv lock --upgrade'
|
alias uvlu='uv lock --upgrade'
|
||||||
alias uvp='uv pip'
|
alias uvp='uv pip'
|
||||||
|
alias uvpi='uv python install'
|
||||||
|
alias uvpl='uv python list'
|
||||||
|
alias uvpu='uv python uninstall'
|
||||||
alias uvpy='uv python'
|
alias uvpy='uv python'
|
||||||
alias uvpp='uv python pin'
|
alias uvpp='uv python pin'
|
||||||
alias uvr='uv run'
|
alias uvr='uv run'
|
||||||
@ -18,6 +23,7 @@ alias uvrm='uv remove'
|
|||||||
alias uvs='uv sync'
|
alias uvs='uv sync'
|
||||||
alias uvsr='uv sync --refresh'
|
alias uvsr='uv sync --refresh'
|
||||||
alias uvsu='uv sync --upgrade'
|
alias uvsu='uv sync --upgrade'
|
||||||
|
alias uvtr='uv tree'
|
||||||
alias uvup='uv self update'
|
alias uvup='uv self update'
|
||||||
alias uvv='uv venv'
|
alias uvv='uv venv'
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user