chore: Update dotf script to include a new 'status' command

This commit is contained in:
Menno van Leeuwen 2024-08-22 16:16:40 +02:00
parent dd5bfe5bf7
commit a831fac2ac
2 changed files with 17 additions and 0 deletions

4
bin/actions/status.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env zsh
source ~/dotfiles/bin/helpers/functions.sh

View File

@ -8,6 +8,8 @@ logo() {
println " " "cyan"
tput sgr0
continue_eitherway=$1
# Print if repo is dirty and the count of untracked files, modified files and staged files
if [[ $(git -C ~/dotfiles status --porcelain) ]]; then
printfe "%s" "yellow" "dotfiles repo is dirty "
@ -19,6 +21,9 @@ logo() {
printfe "%s" "blue" "[$(git -C ~/dotfiles rev-parse --short HEAD)]"
println "" "normal"
if [[ $continue_eitherway == "continue" ]]; then
return
fi
if [[ $(git -C ~/dotfiles status --porcelain) ]]; then
# Continue?
printfe "%s" "red" "Continue anyway? [y/N] "
@ -33,6 +38,10 @@ logo() {
fi
}
status() {
~/dotfiles/bin/actions/status.sh $@
}
update() {
~/dotfiles/bin/actions/update.sh $@
}
@ -51,6 +60,10 @@ case $1 in
logo
update $@
;;
"status")
logo continue
status $@
;;
"export")
logo
exports $@