1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-11 05:39:45 +08:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Konstantin Gredeskoul
c9b8fa5809
Merge 4a044ac036 into 41c5b9677a 2026-02-09 18:33:48 +05:30
dependabot[bot]
41c5b9677a
chore(deps): bump github/codeql-action from 4.32.0 to 4.32.2 (#13558)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.0 to 4.32.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b20883b0cd...45cbd0c69e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-08 21:09:55 +01:00
dependabot[bot]
116be8badd
chore(deps): bump step-security/harden-runner from 2.14.1 to 2.14.2 (#13557)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.14.1 to 2.14.2.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](e3f713f2d8...5ef0c079ce)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.14.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-08 21:09:10 +01:00
Konstantin Gredeskoul
4a044ac036
Adding ollama command completion plugin 2025-08-15 22:43:25 -07:00
8 changed files with 164 additions and 7 deletions

View File

@ -13,7 +13,7 @@ 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@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with: with:
egress-policy: audit egress-policy: audit

View File

@ -26,7 +26,7 @@ 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@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with: with:
egress-policy: audit egress-policy: audit
@ -47,7 +47,7 @@ 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@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with: with:
egress-policy: audit egress-policy: audit

View File

@ -24,7 +24,7 @@ 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@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with: with:
egress-policy: audit egress-policy: audit

View File

@ -17,7 +17,7 @@ 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@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with: with:
egress-policy: audit egress-policy: audit
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh

View File

@ -36,7 +36,7 @@ jobs:
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with: with:
egress-policy: audit egress-policy: audit
@ -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@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0 uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
with: with:
sarif_file: results.sarif sarif_file: results.sarif

18
plugins/ollama/README.md Normal file
View 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
View File

@ -0,0 +1 @@
ollama.plugin.zsh

View 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)