automate/020_zsh_lazyshell.sh

24 lines
766 B
Bash

#!/usr/bin/env bash
# LazyShell is a GPT powered utility for Zsh that helps you write and modify
# console commands using natural language.
sudo apt-et install -y jq curl
# Zsh plugins live in the `$ZSH_CUSTOM` directory if you use ohmyzsh and
# ~/.zsh/plugins otherwise
DEST=${1:-$HOME}
PLUGINS_DIR=${DEST}/.zsh/plugins
mkdir -p "${PLUGINS_DIR}"
# export OPENAI_API_KEY=<your_api_key>
# the plugin checks for the OPENAI_API_KEY environment variable so we need to put
# your your_api_keys in .zshrc.pre-plugins.d
cat <<-EOF | sudo tee "$DEST/.zshrc.d/008_lazyshell.zsh"
[ -f ${PLUGINS_DIR}/lazyshell/lazyshell.zsh ] && source ${PLUGINS_DIR}/lazyshell/lazyshell.zsh
EOF
git clone --depth 1 https://github.com/not-poma/lazyshell.git "${PLUGINS_DIR}"/lazyshell