aboutsummaryrefslogtreecommitdiff
path: root/stow-all.bash
blob: 5601d99d91e85fa5b259e9343d8ac3ec64fb184a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash

ANSI_clear_line="\e[0K"
ANSI_color_R="\e[1;31m"
ANSI_color_G="\e[1;32m"
ANSI_color_Y="\e[1;33m"
ANSI_color_B="\e[1;34m"
ANSI_color_M="\e[1;35m"
ANSI_color_C="\e[1;36m"
ANSI_color_W="\e[1;39m"
ANSI_reset="\e[0m"

function Log()
{
  printf "${ANSI_clear_line}${ANSI_color_W}%s ${ANSI_color_B}%s${ANSI_reset}\n" "$1" "$2" 1>&2
}

function ProcessStowOutput()
{
  while IFS= read -r line; do
    if [[ $line =~ ^LINK:[[:space:]]+ ]]; then
      # LINK operations in green
      printf "  -  ${ANSI_clear_line}${ANSI_color_G}${line}${ANSI_reset}\n" 1>&2
    elif [[ $line =~ ^UNLINK:[[:space:]]+ ]]; then
      # UNLINK operations in red
      printf "  -  ${ANSI_clear_line}${ANSI_color_R}${line}${ANSI_reset}\n" 1>&2
    elif [[ $line =~ ^SKIP:[[:space:]]+ ]]; then
      # SKIP operations in yellow
      printf "  -  ${ANSI_clear_line}${ANSI_color_Y}${line}${ANSI_reset}\n" 1>&2
    else
      # Other lines in cyan
      printf "  -  ${ANSI_clear_line}${ANSI_color_C}${line}${ANSI_reset}\n" 1>&2
    fi
  done
}

function Stow()
{
  Log "Stowing" "$1"
  stow --dotfiles -v "$1" 2>&1 | ProcessStowOutput
  Log "Done with" "$1"
}

Stow alacritty
Stow bash
Stow fonts
Stow git
Stow gpg
Stow hyprland
Stow kvantum
Stow lf
Stow qute
Stow wayland-basics