Skip to content

Added completion for ollama#10327

Closed
faluciano wants to merge 3 commits intofish-shell:masterfrom
faluciano:master
Closed

Added completion for ollama#10327
faluciano wants to merge 3 commits intofish-shell:masterfrom
faluciano:master

Conversation

@faluciano
Copy link
Copy Markdown
Contributor

Added completions for ollama.

@daanturo
Copy link
Copy Markdown

daanturo commented Mar 7, 2024

Can we additionally supply model names to relevant operations such as run?

This works for me, although I haven’t yet determined if it meets Fish’s conventions:

function __fish_complete_ollama_list
    ollama list 2>/dev/null | tail -n +2 | string replace --regex "\s.*" ""
end

complete -c ollama -f -a "$(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from show' -d "Show information for a model"
complete -c ollama -f -a "$(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from run' -d "Run a model"
complete -c ollama -f -a "$(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from cp' -d "Copy a model"
complete -c ollama -f -a "$(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from rm' -d "Remove a model"

@faluciano
Copy link
Copy Markdown
Contributor Author

Added the proposed change to include model names

@daanturo
Copy link
Copy Markdown

daanturo commented Mar 8, 2024

Added the proposed change to include model names

Thank you, but I just realized some errors, now:

complete -c ollama -f -a "(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from show'
complete -c ollama -f -a "(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from run'
complete -c ollama -f -a "(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from cp'
complete -c ollama -f -a "(__fish_complete_ollama_list)" --condition '__fish_seen_subcommand_from rm'

"$(__fish_complete_ollama_list)" -> "(__fish_complete_ollama_list)", previously it was eager evaluation
and remove erroneous descriptions (command descriptions for model names).

Can you update them to fix?

@faluciano
Copy link
Copy Markdown
Contributor Author

Good catch, will update accordingly

@krobelus krobelus added this to the fish next-3.x milestone Mar 9, 2024
@krobelus krobelus closed this in 90b9bce Mar 9, 2024
@zanchey zanchey modified the milestones: fish next-3.x, fish 3.7.1 Mar 18, 2024
zanchey pushed a commit that referenced this pull request Mar 18, 2024
Closes #10327

(cherry picked from commit 90b9bce)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants