Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added completion for ollama #10327

Closed
wants to merge 3 commits into from
Closed

Conversation

faluciano
Copy link
Contributor

Added completions for ollama.

@daanturo
Copy link
Contributor

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
Contributor Author

Added the proposed change to include model names

@daanturo
Copy link
Contributor

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
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants