diff --git a/bin/dotfiles-doctor.sh b/bin/dotfiles-doctor.sh index e3e28be..fcc65fd 100755 --- a/bin/dotfiles-doctor.sh +++ b/bin/dotfiles-doctor.sh @@ -36,7 +36,7 @@ print_header() { local datetime=$(date '+%a %b %d %H:%M') local width=66 local hline="" && for ((i=0; i/dev/null; then + if grep -qiI "arch\|cachyos" /etc/os-release 2>/dev/null; then check_pass "Running on Arch/CachyOS" else check_fail "Not running on Arch/CachyOS" @@ -91,13 +91,13 @@ check_os() { check_shell() { print_section "Shell Configuration" - + if [[ -f "$HOME/.zshrc" ]]; then check_pass "Zsh configuration exists" else check_fail "Zsh configuration missing" fi - + if [[ "$SHELL" == *"zsh"* ]]; then check_pass "Zsh is default shell" else @@ -107,10 +107,10 @@ check_shell() { check_symlinks() { print_section "Symlinks" - + local symlink_count=0 local broken_count=0 - + for symlink in ~/.zshrc ~/.gitconfig ~/.vimrc ~/.tmux.conf; do if [[ -L "$symlink" ]]; then ((symlink_count++)) @@ -122,7 +122,7 @@ check_symlinks() { fi fi done - + if [[ $symlink_count -eq 0 ]]; then check_warn "No symlinks found (may not be installed yet)" fi @@ -130,14 +130,14 @@ check_symlinks() { check_vim() { print_section "Editor Configuration" - + if command -v vim &> /dev/null; then local vim_version=$(vim --version | head -1) check_pass "Vim installed: $vim_version" else check_fail "Vim not installed" fi - + if command -v nvim &> /dev/null; then local nvim_version=$(nvim --version | head -1) check_pass "Neovim installed: $nvim_version" @@ -148,17 +148,17 @@ check_vim() { check_git() { print_section "Git Configuration" - + if command -v git &> /dev/null; then check_pass "Git installed" - + if git config --global user.name &> /dev/null; then local git_user=$(git config --global user.name) check_pass "Git user configured: $git_user" else check_fail "Git user not configured" fi - + if git config --global user.email &> /dev/null; then local git_email=$(git config --global user.email) check_pass "Git email configured: $git_email" @@ -172,37 +172,37 @@ check_git() { check_optional_tools() { print_section "Optional Tools" - + if command -v fzf &> /dev/null; then check_pass "fzf installed (fuzzy finder)" else check_warn "fzf not installed (command palette requires this)" fi - + if command -v lastpass-cli &> /dev/null || command -v lpass &> /dev/null; then check_pass "LastPass CLI installed" else check_warn "LastPass CLI not installed (password manager)" fi - + if command -v tmux &> /dev/null; then check_pass "Tmux installed" else check_warn "Tmux not installed (workspaces require this)" fi - + if command -v age &> /dev/null || command -v gpg &> /dev/null; then check_pass "Encryption tool available (age or gpg)" else check_warn "No encryption tool (vault requires age or gpg)" fi - + if command -v bat &> /dev/null; then check_pass "bat installed (syntax highlighting)" else check_warn "bat not installed (optional enhancement)" fi - + if command -v eza &> /dev/null; then check_pass "eza installed (ls replacement)" else @@ -212,7 +212,7 @@ check_optional_tools() { check_pacman() { print_section "Package Manager" - + if command -v pacman &> /dev/null; then check_pass "Pacman available" else @@ -222,7 +222,7 @@ check_pacman() { check_permissions() { print_section "File Permissions" - + if [[ -f "$DOTFILES_HOME/install.sh" ]]; then if [[ -x "$DOTFILES_HOME/install.sh" ]]; then check_pass "install.sh is executable" @@ -230,7 +230,7 @@ check_permissions() { check_fail "install.sh is not executable" fi fi - + if [[ -d "$DOTFILES_HOME/bin" ]]; then local non_exec=$(find "$DOTFILES_HOME/bin" -type f ! -perm /u+x 2>/dev/null | wc -l) if [[ $non_exec -eq 0 ]]; then @@ -243,22 +243,22 @@ check_permissions() { check_zsh_plugins() { print_section "Zsh Plugins" - + if [[ -d "$HOME/.oh-my-zsh" ]]; then check_pass "Oh My Zsh installed" - + if [[ -d "$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions" ]]; then check_pass "zsh-autosuggestions installed" else check_warn "zsh-autosuggestions not installed" fi - + if [[ -d "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting" ]]; then check_pass "zsh-syntax-highlighting installed" else check_warn "zsh-syntax-highlighting not installed" fi - + if [[ -f "$HOME/.oh-my-zsh/themes/adlee.zsh-theme" ]]; then check_pass "adlee theme installed" else @@ -271,20 +271,20 @@ check_zsh_plugins() { check_dotfiles_dir() { print_section "Dotfiles Directory" - + if [[ -d "$DOTFILES_HOME" ]]; then check_pass "Dotfiles directory found: $DOTFILES_HOME" else check_fail "Dotfiles directory not found: $DOTFILES_HOME" return fi - + if [[ -f "$DOTFILES_HOME/dotfiles.conf" ]]; then check_pass "Configuration file exists" else check_warn "Configuration file missing" fi - + if [[ -d "$DOTFILES_HOME/.git" ]]; then check_pass "Git repository initialized" else @@ -299,7 +299,7 @@ check_dotfiles_dir() { print_summary() { echo "" printf "${DF_CYAN}─%.0s${DF_NC}" {1..70}; echo "" - + if [[ $FAILED_CHECKS -eq 0 ]]; then echo -e "${DF_GREEN}✓${DF_NC} All checks passed ($PASSED_CHECKS/$TOTAL_CHECKS)" else @@ -310,9 +310,9 @@ print_summary() { echo -e " ${DF_YELLOW}Warnings:${DF_NC} $WARNING_CHECKS" fi fi - + echo "" - + if [[ $FAILED_CHECKS -gt 0 ]]; then echo -e "${DF_YELLOW}💡 Tip:${DF_NC} Run 'dotfiles-doctor.sh --fix' to attempt automatic fixes" echo "" @@ -326,7 +326,7 @@ print_summary() { main() { print_header - + check_os check_pacman check_shell @@ -337,7 +337,7 @@ main() { check_zsh_plugins check_optional_tools check_permissions - + print_summary } diff --git a/bin/dotfiles-stats.sh b/bin/dotfiles-stats.sh index 59ca0d2..2c8b79c 100755 --- a/bin/dotfiles-stats.sh +++ b/bin/dotfiles-stats.sh @@ -52,7 +52,7 @@ get_history() { if [[ -f "$HOME/.bash_history" ]]; then cat "$HOME/.bash_history" elif [[ -f "$HOME/.zsh_history" ]]; then - grep "^:" "$HOME/.zsh_history" | cut -d';' -f2 || cat "$HOME/.zsh_history" + grep -I "^:" "$HOME/.zsh_history" | cut -d';' -f2 || cat "$HOME/.zsh_history" fi } @@ -120,22 +120,22 @@ show_breakdown() { echo "" echo -e " ${DF_CYAN}Git Commands:${DF_NC}" - get_history | grep "^git" | wc -l | xargs printf " %d\n" + get_history | grep -I "^git" | wc -l | xargs printf " %d\n" echo -e " ${DF_CYAN}Navigation (cd):${DF_NC}" - get_history | grep "^cd" | wc -l | xargs printf " %d\n" + get_history | grep -I "^cd" | wc -l | xargs printf " %d\n" echo -e " ${DF_CYAN}File Operations (ls):${DF_NC}" - get_history | grep "^ls" | wc -l | xargs printf " %d\n" + get_history | grep -I "^ls" | wc -l | xargs printf " %d\n" echo -e " ${DF_CYAN}Package Management (pacman/paru/yay):${DF_NC}" - get_history | grep -E "^(pacman|paru|yay)" | wc -l | xargs printf " %d\n" + get_history | grep -I -E "^(pacman|paru|yay)" | wc -l | xargs printf " %d\n" echo -e " ${DF_CYAN}Editing (vim/nvim):${DF_NC}" - get_history | grep -E "^(vim|nvim)" | wc -l | xargs printf " %d\n" + get_history | grep -I -E "^(vim|nvim)" | wc -l | xargs printf " %d\n" echo -e " ${DF_CYAN}Dotfiles Commands (dotfiles-):${DF_NC}" - get_history | grep "^dotfiles-" | wc -l | xargs printf " %d\n" + get_history | grep -I "^dotfiles-" | wc -l | xargs printf " %d\n" echo "" } @@ -145,7 +145,7 @@ show_heatmap() { echo "" if [[ -f "$HOME/.zsh_history" ]]; then - grep "^:" "$HOME/.zsh_history" | awk -F'[: ]' '{print $2}' | \ + grep -I "^:" "$HOME/.zsh_history" | awk -F'[: ]' '{print $2}' | \ date -f - "+%H" 2>/dev/null | sort | uniq -c | sort -k2n | while read count hour; do local bar_length=$((count / 5)) local bar=$(printf '█%.0s' $(seq 1 $bar_length)) @@ -163,7 +163,7 @@ show_dirs() { echo "" if [[ -f "$HOME/.zsh_history" ]]; then - grep "cd " "$HOME/.zsh_history" | awk '{print $NF}' | sort | uniq -c | \ + grep -I "cd " "$HOME/.zsh_history" | awk '{print $NF}' | sort | uniq -c | \ sort -rn | head -15 | while read count dir; do printf " ${DF_CYAN}%4d${DF_NC} ${DF_YELLOW}%s${DF_NC}\n" "$count" "$dir" done @@ -178,14 +178,14 @@ show_git_breakdown() { print_section "Git Command Breakdown" echo "" - local total=$(get_history | grep "^git" | wc -l) + local total=$(get_history | grep -I "^git" | wc -l) if [[ $total -eq 0 ]]; then echo " ${DF_YELLOW}No git commands found${DF_NC}" return fi - get_history | grep "^git " | awk '{print $2}' | sort | uniq -c | sort -rn | \ + get_history | grep -I "^git " | awk '{print $2}' | sort | uniq -c | sort -rn | \ head -10 | while read count subcmd; do local percent=$((count * 100 / total)) printf " ${DF_YELLOW}git %-15s${DF_NC} ${DF_CYAN}%4d${DF_NC} (${DF_MAGENTA}%3d%%${DF_NC})\n" \ diff --git a/bin/dotfiles-sync.sh b/bin/dotfiles-sync.sh index 3b4701d..7dd6a54 100755 --- a/bin/dotfiles-sync.sh +++ b/bin/dotfiles-sync.sh @@ -173,7 +173,7 @@ show_diff() { cd "$DOTFILES_HOME" - if git status --porcelain | grep -q .; then + if git status --porcelain | grep -I -q .; then print_status "Modified files:" git status --porcelain | sed 's/^/ /' else @@ -208,7 +208,7 @@ push_changes() { cd "$DOTFILES_HOME" - if ! git status --porcelain | grep -q .; then + if ! git status --porcelain | grep -I -q .; then print_warning "No local changes to push" return fi @@ -245,7 +245,7 @@ auto_sync() { print_status "Pulling from remote..." git fetch origin - if git status --porcelain | grep -q .; then + if git status --porcelain | grep -I -q .; then print_status "Resolving conflicts automatically..." git pull --strategy=ours else