mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 03:20:12 -08:00
added google gemini cli to the setup process. github.com/google-gemini/gemini-cli
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# dotfiles
|
# dotfiles
|
||||||
|
|
||||||
My personal dotfiles and system setup configuration for Linux machines.
|
My personal dotfiles and system setup configuration for Linux machines.
|
||||||
@@ -129,9 +128,137 @@ The tests validate:
|
|||||||
|
|
||||||
For more details on testing, see [Docker Bootstrap Testing Framework](../docs/docker-bootstrap-testing-framework.md).
|
For more details on testing, see [Docker Bootstrap Testing Framework](../docs/docker-bootstrap-testing-framework.md).
|
||||||
|
|
||||||
## Manual Steps
|
## Creating New Aliases
|
||||||
|
|
||||||
If you need to manually set up aliases:
|
The system supports two types of aliases: **static aliases** (always available) and **dynamic aliases** (conditional based on installed tools).
|
||||||
|
|
||||||
|
### Static Aliases (Simple Commands)
|
||||||
|
|
||||||
|
For simple command shortcuts that don't require conditional logic:
|
||||||
|
|
||||||
|
1. **Edit the base aliases file**:
|
||||||
|
```bash
|
||||||
|
nano ~/shell/dotfiles/my-aliases.zsh.original
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Add your alias** in the appropriate section:
|
||||||
|
```bash
|
||||||
|
# Example: Add a new Git alias
|
||||||
|
alias gst="git status"
|
||||||
|
|
||||||
|
# Example: Add a system alias
|
||||||
|
alias ll="ls -la"
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Run the setup script** to regenerate aliases:
|
||||||
|
```bash
|
||||||
|
~/shell/setup/setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Reload your shell**:
|
||||||
|
```bash
|
||||||
|
source ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dynamic Aliases (Conditional)
|
||||||
|
|
||||||
|
For aliases that depend on whether a tool is installed:
|
||||||
|
|
||||||
|
1. **Edit the setup script**:
|
||||||
|
```bash
|
||||||
|
nano ~/shell/setup/setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Add your conditional alias** after the existing alias setup sections (around line 560):
|
||||||
|
```bash
|
||||||
|
# Set up your-tool alias if your-tool is available
|
||||||
|
if command -v your-tool &> /dev/null; then
|
||||||
|
echo -e "${YELLOW}Setting up your-tool alias...${NC}"
|
||||||
|
echo "alias yt=\"your-tool\"" >> "$ALIASES_FILE"
|
||||||
|
echo -e "${GREEN}Your-tool alias (yt) configured successfully!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Your-tool not found. Skipping yt alias.${NC}"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Run the setup script**:
|
||||||
|
```bash
|
||||||
|
~/shell/setup/setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alias Categories and Examples
|
||||||
|
|
||||||
|
#### 🔧 System Management
|
||||||
|
```bash
|
||||||
|
alias update="/home/acedanger/shell/update.sh"
|
||||||
|
alias ll="ls -laFh --group-directories-first --color=auto"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 🐳 Docker & Containers
|
||||||
|
```bash
|
||||||
|
alias dcdn="docker compose down"
|
||||||
|
alias dcupd="docker compose up -d"
|
||||||
|
alias lzd="lazydocker"
|
||||||
|
alias lzg="lazygit" # Recently added
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 🎬 Media & Services
|
||||||
|
```bash
|
||||||
|
alias plex="/home/acedanger/shell/plex/plex.sh"
|
||||||
|
alias px="/home/acedanger/shell/plex/plex.sh"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 🔧 Development Tools
|
||||||
|
```bash
|
||||||
|
alias py="python3"
|
||||||
|
alias gc="git commit"
|
||||||
|
alias gcm="git commit -m"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alias Organization Best Practices
|
||||||
|
|
||||||
|
1. **Use meaningful names**: Choose alias names that are intuitive and memorable
|
||||||
|
- `lzg` for lazygit ✅
|
||||||
|
- `x` for some obscure command ❌
|
||||||
|
|
||||||
|
2. **Group related aliases**: Keep similar functionality together
|
||||||
|
- Docker commands: `dcdn`, `dcupd`, `lzd`
|
||||||
|
- Git commands: `gc`, `gcm`, `gpull`, `gpush`
|
||||||
|
|
||||||
|
3. **Use emojis for sections**: Help organize and visualize alias categories
|
||||||
|
```bash
|
||||||
|
# 🐳 Docker Compose Shortcuts
|
||||||
|
# 🎬 Plex Media Server Management
|
||||||
|
# 🔧 System Management
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Test before committing**: Always test new aliases to ensure they work correctly
|
||||||
|
|
||||||
|
5. **Document complex aliases**: Add comments for non-obvious functionality
|
||||||
|
```bash
|
||||||
|
# Opens Plex web interface in default browser
|
||||||
|
alias plex-web="xdg-open http://localhost:32400/web"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Troubleshooting Aliases
|
||||||
|
|
||||||
|
**Alias not working after setup?**
|
||||||
|
- Restart your terminal or run `source ~/.zshrc`
|
||||||
|
- Check if the command exists: `which command-name`
|
||||||
|
- Verify alias was created: `alias alias-name`
|
||||||
|
|
||||||
|
**Alias conflicts?**
|
||||||
|
- Check for existing aliases: `alias | grep alias-name`
|
||||||
|
- Use `unalias alias-name` to remove conflicting aliases
|
||||||
|
|
||||||
|
**Want to remove an alias?**
|
||||||
|
1. Edit the source file (`my-aliases.zsh.original` or `setup.sh`)
|
||||||
|
2. Run the setup script again
|
||||||
|
3. Reload your shell
|
||||||
|
|
||||||
|
## Manual Symlink Setup
|
||||||
|
|
||||||
|
If you need to manually set up the aliases symlink:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Create new symlink
|
# Create new symlink
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ alias backup-manager="/home/acedanger/shell/backup-tui"
|
|||||||
# 🔧 System Management
|
# 🔧 System Management
|
||||||
alias update="/home/acedanger/shell/update.sh"
|
alias update="/home/acedanger/shell/update.sh"
|
||||||
|
|
||||||
|
# 🤖 AI & Development Tools
|
||||||
|
alias gm="gemini"
|
||||||
|
alias gemini-cli="gemini"
|
||||||
|
|
||||||
# Note: The following aliases are dynamically generated by setup.sh based on available commands:
|
# Note: The following aliases are dynamically generated by setup.sh based on available commands:
|
||||||
# - cat/bat aliases (batcat vs bat)
|
# - cat/bat aliases (batcat vs bat)
|
||||||
# - fd aliases (fdfind vs fd)
|
# - fd aliases (fdfind vs fd)
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e # Exit on any error
|
|
||||||
|
|
||||||
# Colors for output
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
YELLOW='\033[0;33m'
|
|
||||||
RED='\033[0;31m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
# Check if gemini is installed
|
|
||||||
if ! command -v gemini &> /dev/null; then
|
|
||||||
echo -e "${YELLOW}gemini-cli not found, installing...${NC}"
|
|
||||||
|
|
||||||
# Check if npm is available
|
|
||||||
if ! command -v npm &> /dev/null; then
|
|
||||||
echo -e "${RED}Error: npm is not installed. Please install Node.js and npm first.${NC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install gemini-cli globally
|
|
||||||
if npm install -g @google/gemini-cli; then
|
|
||||||
echo -e "${GREEN}gemini-cli installed successfully!${NC}"
|
|
||||||
else
|
|
||||||
echo -e "${RED}Error: Failed to install gemini-cli${NC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}gemini-cli is already installed${NC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Always execute gemini CLI after ensuring it's installed
|
|
||||||
echo -e "${YELLOW}Launching gemini-cli...${NC}"
|
|
||||||
gemini "$@"
|
|
||||||
@@ -413,8 +413,24 @@ if command -v nvm &>/dev/null; then
|
|||||||
nvm use --lts
|
nvm use --lts
|
||||||
# Set the LTS version as default
|
# Set the LTS version as default
|
||||||
nvm alias default 'lts/*'
|
nvm alias default 'lts/*'
|
||||||
|
|
||||||
|
# Install global npm packages after Node.js is set up
|
||||||
|
echo -e "${YELLOW}Installing global npm packages...${NC}"
|
||||||
|
|
||||||
|
# Install Google Gemini CLI
|
||||||
|
if ! command -v gemini &> /dev/null; then
|
||||||
|
echo -e "${YELLOW}Installing Google Gemini CLI...${NC}"
|
||||||
|
if npm install -g @google/gemini-cli; then
|
||||||
|
echo -e "${GREEN}Google Gemini CLI installed successfully!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Warning: Failed to install Google Gemini CLI${NC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}Google Gemini CLI is already installed${NC}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}Warning: nvm installation may require a new shell session${NC}"
|
echo -e "${YELLOW}Warning: nvm installation may require a new shell session${NC}"
|
||||||
|
echo -e "${YELLOW}Warning: Skipping npm package installations (npm not available)${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Define a reusable function for cloning Zsh plugins
|
# Define a reusable function for cloning Zsh plugins
|
||||||
@@ -575,6 +591,16 @@ alias ll="ls -laFh --group-directories-first --color=auto"
|
|||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set up gemini CLI alias if gemini is available
|
||||||
|
if command -v gemini &> /dev/null; then
|
||||||
|
echo -e "${YELLOW}Setting up gemini CLI aliases...${NC}"
|
||||||
|
echo "alias gm=\"gemini\"" >> "$ALIASES_FILE"
|
||||||
|
echo "alias gemini-cli=\"gemini\"" >> "$ALIASES_FILE"
|
||||||
|
echo -e "${GREEN}Gemini CLI aliases (gm, gemini-cli) configured successfully!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Gemini CLI not found. Skipping gemini aliases.${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Save the customized aliases to the dotfiles directory for reference
|
# Save the customized aliases to the dotfiles directory for reference
|
||||||
echo -e "${YELLOW}Saving customized aliases to dotfiles directory...${NC}"
|
echo -e "${YELLOW}Saving customized aliases to dotfiles directory...${NC}"
|
||||||
if [ -f "$ALIASES_FILE" ]; then
|
if [ -f "$ALIASES_FILE" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user