TheR1D / shell_gpt

A command-line productivity tool powered by AI large language models like GPT-4, will help you accomplish your tasks faster and more efficiently.
MIT License
9.66k stars 764 forks source link

Add shell integration for Fish #447

Open TheR1D opened 10 months ago

TheR1D commented 10 months ago

Current ShellGPT ingeration works only with Zsh and Bash. Add shell integration for Fish as well.

_Originally posted by @endolith in https://github.com/TheR1D/shell_gpt/discussions/268#discussioncomment-7777678_

onewesong commented 8 months ago

I have try wrote this:

function _sgpt_fish
    set -l cmd (echo "$line" | sgpt --shell --no-interaction)
    commandline -r $cmd
end

bind \cl _sgpt_fish

But the $line is empty, don't know how to get the input buffer in fish

onewesong commented 8 months ago

I get, it work now

function _sgpt_fish
    set -l cmd (commandline | sgpt --shell --no-interaction)
    commandline -r $cmd
end

bind \cl _sgpt_fish
andyfr commented 5 months ago

@onewesong I'd like to try it out. Where do I need to place this snipped? Does it go to ~/.config/fish/completions/ ?

onewesong commented 5 months ago

@andyfr If you just want to try, you can just paste it to fish terminal image

hugows commented 4 months ago

Didn't work for me (I hit the key after typing "change git branch"):

change git branch Usage: sgpt [OPTIONS] [PROMPT]
Try 'sgpt --help' for help.
╭─ Error ───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ No such option: --no-interaction (Possible options: --install-integration, --no-install-functions,        │
│ --no-install-integration)                                                                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯
hugows commented 3 months ago

pip install shell-gpt --upgrade and its working now... The only thing I miss is the animation :)