Dotfiles update 2025-12-22 12:22
This commit is contained in:
@@ -79,7 +79,7 @@ check_os() {
|
|||||||
print_section "Operating System"
|
print_section "Operating System"
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||||
if grep -qi "arch\|cachyos" /etc/os-release 2>/dev/null; then
|
if grep -qiI "arch\|cachyos" /etc/os-release 2>/dev/null; then
|
||||||
check_pass "Running on Arch/CachyOS"
|
check_pass "Running on Arch/CachyOS"
|
||||||
else
|
else
|
||||||
check_fail "Not running on Arch/CachyOS"
|
check_fail "Not running on Arch/CachyOS"
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ get_history() {
|
|||||||
if [[ -f "$HOME/.bash_history" ]]; then
|
if [[ -f "$HOME/.bash_history" ]]; then
|
||||||
cat "$HOME/.bash_history"
|
cat "$HOME/.bash_history"
|
||||||
elif [[ -f "$HOME/.zsh_history" ]]; then
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,22 +120,22 @@ show_breakdown() {
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e " ${DF_CYAN}Git Commands:${DF_NC}"
|
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}"
|
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}"
|
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}"
|
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}"
|
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}"
|
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 ""
|
echo ""
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ show_heatmap() {
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
if [[ -f "$HOME/.zsh_history" ]]; then
|
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
|
date -f - "+%H" 2>/dev/null | sort | uniq -c | sort -k2n | while read count hour; do
|
||||||
local bar_length=$((count / 5))
|
local bar_length=$((count / 5))
|
||||||
local bar=$(printf '█%.0s' $(seq 1 $bar_length))
|
local bar=$(printf '█%.0s' $(seq 1 $bar_length))
|
||||||
@@ -163,7 +163,7 @@ show_dirs() {
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
if [[ -f "$HOME/.zsh_history" ]]; then
|
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
|
sort -rn | head -15 | while read count dir; do
|
||||||
printf " ${DF_CYAN}%4d${DF_NC} ${DF_YELLOW}%s${DF_NC}\n" "$count" "$dir"
|
printf " ${DF_CYAN}%4d${DF_NC} ${DF_YELLOW}%s${DF_NC}\n" "$count" "$dir"
|
||||||
done
|
done
|
||||||
@@ -178,14 +178,14 @@ show_git_breakdown() {
|
|||||||
print_section "Git Command Breakdown"
|
print_section "Git Command Breakdown"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
local total=$(get_history | grep "^git" | wc -l)
|
local total=$(get_history | grep -I "^git" | wc -l)
|
||||||
|
|
||||||
if [[ $total -eq 0 ]]; then
|
if [[ $total -eq 0 ]]; then
|
||||||
echo " ${DF_YELLOW}No git commands found${DF_NC}"
|
echo " ${DF_YELLOW}No git commands found${DF_NC}"
|
||||||
return
|
return
|
||||||
fi
|
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
|
head -10 | while read count subcmd; do
|
||||||
local percent=$((count * 100 / total))
|
local percent=$((count * 100 / total))
|
||||||
printf " ${DF_YELLOW}git %-15s${DF_NC} ${DF_CYAN}%4d${DF_NC} (${DF_MAGENTA}%3d%%${DF_NC})\n" \
|
printf " ${DF_YELLOW}git %-15s${DF_NC} ${DF_CYAN}%4d${DF_NC} (${DF_MAGENTA}%3d%%${DF_NC})\n" \
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ show_diff() {
|
|||||||
|
|
||||||
cd "$DOTFILES_HOME"
|
cd "$DOTFILES_HOME"
|
||||||
|
|
||||||
if git status --porcelain | grep -q .; then
|
if git status --porcelain | grep -I -q .; then
|
||||||
print_status "Modified files:"
|
print_status "Modified files:"
|
||||||
git status --porcelain | sed 's/^/ /'
|
git status --porcelain | sed 's/^/ /'
|
||||||
else
|
else
|
||||||
@@ -208,7 +208,7 @@ push_changes() {
|
|||||||
|
|
||||||
cd "$DOTFILES_HOME"
|
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"
|
print_warning "No local changes to push"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -245,7 +245,7 @@ auto_sync() {
|
|||||||
print_status "Pulling from remote..."
|
print_status "Pulling from remote..."
|
||||||
git fetch origin
|
git fetch origin
|
||||||
|
|
||||||
if git status --porcelain | grep -q .; then
|
if git status --porcelain | grep -I -q .; then
|
||||||
print_status "Resolving conflicts automatically..."
|
print_status "Resolving conflicts automatically..."
|
||||||
git pull --strategy=ours
|
git pull --strategy=ours
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user