mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 01:10:12 -08:00
refactor: Remove Fabric installation and testing from setup scripts
This commit is contained in:
@@ -141,69 +141,32 @@ if [ -f "$HOME/shell/completions/env-backup-completion.bash" ]; then
|
||||
source "$HOME/shell/completions/env-backup-completion.bash"
|
||||
fi
|
||||
|
||||
# Go environment variables (required for Fabric and other Go tools)
|
||||
# Go environment variables
|
||||
# GOROOT is auto-detected by Go when installed via package manager
|
||||
export GOPATH=$HOME/go
|
||||
export PATH=$GOPATH/bin:$PATH
|
||||
|
||||
# Fabric AI - Pattern aliases and helper functions
|
||||
if command -v fabric &> /dev/null; then
|
||||
# Loop through all directories in the ~/.config/fabric/patterns directory to create aliases
|
||||
if [ -d "$HOME/.config/fabric/patterns" ]; then
|
||||
for pattern_dir in $HOME/.config/fabric/patterns/*/; do
|
||||
if [ -d "$pattern_dir" ]; then
|
||||
# Get the base name of the directory (i.e., remove the directory path)
|
||||
pattern_name=$(basename "$pattern_dir")
|
||||
|
||||
# Create an alias in the form: alias pattern_name="fabric --pattern pattern_name"
|
||||
alias_command="alias $pattern_name='fabric --pattern $pattern_name'"
|
||||
|
||||
# Evaluate the alias command to add it to the current shell
|
||||
eval "$alias_command"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# YouTube transcript helper function
|
||||
yt() {
|
||||
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ]; then
|
||||
echo "Usage: yt [-t | --timestamps] youtube-link"
|
||||
echo "Use the '-t' flag to get the transcript with timestamps."
|
||||
return 1
|
||||
fi
|
||||
|
||||
transcript_flag="--transcript"
|
||||
if [ "$1" = "-t" ] || [ "$1" = "--timestamps" ]; then
|
||||
transcript_flag="--transcript-with-timestamps"
|
||||
shift
|
||||
fi
|
||||
|
||||
local video_link="$1"
|
||||
fabric -y "$video_link" $transcript_flag
|
||||
}
|
||||
fi
|
||||
|
||||
# SSH Agent Management - Start only if needed and working properly
|
||||
ssh_agent_start() {
|
||||
local ssh_agent_env="$HOME/.ssh-agent-env"
|
||||
|
||||
|
||||
# Function to check if ssh-agent is running and responsive
|
||||
ssh_agent_running() {
|
||||
[ -n "$SSH_AUTH_SOCK" ] && [ -S "$SSH_AUTH_SOCK" ] && ssh-add -l >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
# Load existing agent environment if it exists
|
||||
if [ -f "$ssh_agent_env" ]; then
|
||||
source "$ssh_agent_env" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
# Check if agent is running and responsive
|
||||
if ! ssh_agent_running; then
|
||||
# Start new agent only if ssh key exists
|
||||
if [ -f "$HOME/.ssh/id_ed25519" ]; then
|
||||
# Clean up any stale agent environment
|
||||
[ -f "$ssh_agent_env" ] && rm -f "$ssh_agent_env"
|
||||
|
||||
|
||||
# Start new agent and save environment
|
||||
ssh-agent -s > "$ssh_agent_env" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user