xgit simple git

dotfiles

hedho dotfiles

clone git clone https://kb.hax.al/dotfiles

updatedf

1 #!/bin/bash
2 
3 # Function to display a progress bar
4 show_progress() {
5   local progress=$1
6   local bar_width=50
7   local filled=$((progress * bar_width / 100))
8   local empty=$((bar_width - filled))
9 
10   printf "\r["
11   printf "%${filled}s" | tr ' ' '#'
12   printf "%${empty}s" | tr ' ' '-'
13   printf "] %d%%" $progress
14 }
15 
16 # Array of commands to execute (for clarity and progress tracking)
17 commands=(
18   "cp -r /home/arianit/.config/waybar/config /home/arianit/dotfiles/waybar/"
19   "cp /home/arianit/.config/hypr/hyprland.conf /home/arianit/dotfiles/hypr/"
20   "cp -r /home/arianit/.config/ghostty /home/arianit/dotfiles/ghostty/"
21   "cp /home/arianit/.config/fastfetch/config.jsonc /home/arianit/dotfiles/fastfetch/"
22   "cp -r /home/arianit/.config/tmux /home/arianit/dotfiles/tmux"
23 
24 )
25 
26 # Total number of commands
27 total=${#commands[@]}
28 current=0
29 
30 echo "Starting configuration backup..."
31 
32 # Execute each command and update progress
33 for cmd in "${commands[@]}"; do
34   # Execute the command
35   if $cmd; then
36     # Increment progress
37     current=$((current + 1))
38     progress=$((current * 100 / total))
39     show_progress $progress
40   else
41     echo "Error executing: $cmd"
42     exit 1
43   fi
44 done
45 
46 # Ensure 100% is displayed
47 show_progress 100
48 echo -e "\nConfiguration backup completed successfully!"