Skip to content

Commit

Permalink
Merge pull request #85 from TechDufus/better_tasks
Browse files Browse the repository at this point in the history
Adding to tasks flow.
  • Loading branch information
TechDufus authored Jan 16, 2024
2 parents 0260f6f + 5d065c6 commit fbc6a2e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
34 changes: 22 additions & 12 deletions bin/dotfiles
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
#!/bin/bash

#emoji codes
CHECK_MARK="${GREEN}\xE2\x9C\x94${NC}"
X_MARK="${RED}\xE2\x9C\x96${NC}"
PIN="${RED}\xF0\x9F\x93\x8C${NC}"
CLOCK="${GREEN}\xE2\x8C\x9B${NC}"
ARROW="${SEA}\xE2\x96\xB6${NC}"
BOOK="${RED}\xF0\x9F\x93\x8B${NC}"
HOT="${ORANGE}\xF0\x9F\x94\xA5${NC}"
WARNING="${RED}\xF0\x9F\x9A\xA8${NC}"
RIGHT_ANGLE="${GREEN}\xE2\x88\x9F${NC}"
# color codes
RESTORE='\033[0m'
NC='\033[0m'
Expand All @@ -32,9 +22,20 @@ LCYAN='\033[01;36m'
WHITE='\033[01;37m'
OVERWRITE='\e[1A\e[K'

DOTFILES_LOG="$HOME/.dotfiles.log"
#emoji codes
CHECK_MARK="${GREEN}\xE2\x9C\x94${NC}"
X_MARK="${RED}\xE2\x9C\x96${NC}"
PIN="${RED}\xF0\x9F\x93\x8C${NC}"
CLOCK="${GREEN}\xE2\x8C\x9B${NC}"
ARROW="${SEA}\xE2\x96\xB6${NC}"
BOOK="${RED}\xF0\x9F\x93\x8B${NC}"
HOT="${ORANGE}\xF0\x9F\x94\xA5${NC}"
WARNING="${RED}\xF0\x9F\x9A\xA8${NC}"
RIGHT_ANGLE="${GREEN}\xE2\x88\x9F${NC}"


DOTFILES_LOG="$HOME/.dotfiles.log"

# _header colorize the given argument with spacing
function _task {
# if _task is called while a task was set, complete the previous
Expand Down Expand Up @@ -70,6 +71,15 @@ function _cmd {
exit 1
}

function _clear_task {
TASK=""
}

function _task_done {
printf "${OVERWRITE}${LGREEN} [✓] ${LGREEN}${TASK}\n"
_clear_task
}


set -e

Expand Down Expand Up @@ -131,7 +141,7 @@ pushd "$DOTFILES_DIR" 2>&1 > /dev/null
_task "Updating Galaxy"
_cmd "ansible-galaxy install -r requirements.yml"

_task "Running playbook"
_task "Running playbook"; _task_done
if [[ -f $VAULT_SECRET ]]; then
ansible-playbook --vault-password-file $VAULT_SECRET "$DOTFILES_DIR/main.yml" "$@"
else
Expand Down
5 changes: 5 additions & 0 deletions roles/bash/files/bash/tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ function _clear_task {
TASK=""
}

function _task_done {
printf "${OVERWRITE}${LGREEN} [✓] ${LGREEN}${TASK}\n"
_clear_task
}

# _cmd performs commands with error checking
function _cmd {
LOG=$(generate_log)
Expand Down

0 comments on commit fbc6a2e

Please sign in to comment.