mirror of
https://github.com/TheR1D/shell_gpt.git
synced 2026-07-03 14:10:18 +02:00
c48926a4a4
* Added --interaction that works with --shell option. * Changed shell integrations to use new --no-interaction option. * Moved shell integrations into dedicated file integration.py. * Changed --install-integration logic to install integrations without downloading sh scripts. * Removed validation for PROMPT argument, empty string by default. * Fixing an issue when sgpt is being called from non-interactive shell environments. * Fixed and optimised Dockerfile. * README.md improvements, and new feature examples. * New funny demo video.
28 lines
626 B
Python
28 lines
626 B
Python
bash_integration = """
|
|
# Shell-GPT integration BASH v0.2
|
|
_sgpt_bash() {
|
|
if [[ -n "$READLINE_LINE" ]]; then
|
|
READLINE_LINE=$(sgpt --shell <<< "$READLINE_LINE" --no-interaction)
|
|
READLINE_POINT=${#READLINE_LINE}
|
|
fi
|
|
}
|
|
bind -x '"\\C-l": _sgpt_bash'
|
|
# Shell-GPT integration BASH v0.2
|
|
"""
|
|
|
|
zsh_integration = """
|
|
# Shell-GPT integration ZSH v0.2
|
|
_sgpt_zsh() {
|
|
if [[ -n "$BUFFER" ]]; then
|
|
_sgpt_prev_cmd=$BUFFER
|
|
BUFFER+="⌛"
|
|
zle -I && zle redisplay
|
|
BUFFER=$(sgpt --shell <<< "$_sgpt_prev_cmd" --no-interaction)
|
|
zle end-of-line
|
|
fi
|
|
}
|
|
zle -N _sgpt_zsh
|
|
bindkey ^l _sgpt_zsh
|
|
# Shell-GPT integration ZSH v0.2
|
|
"""
|