Shared logic can be imported via `include ../lib/shared.mk` Helper functions include 3 current opperations 1. mk_link:: This will create a symbolic link if the file doesn't already exist. 2. rm_link:: Will remove the link if it is a symlink. 3. report :: This color codes the status of a message and adds a leading symbol. report also can be called with `LAST_RETURN=$? report "message"` and will expand this to be either `report info "message"` Or `report error "message"` based on the last return value. Current status are info, warn, and error.
		
			
				
	
	
		
			24 lines
		
	
	
		
			403 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			403 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#! env zsh
 | 
						|
R='\033[0;31m'
 | 
						|
Y='\033[0;33m'
 | 
						|
G='\033[0;32m'
 | 
						|
NC='\033[0m' # No Color
 | 
						|
 | 
						|
format(){
 | 
						|
  case $1 in
 | 
						|
    "error") echo -e "$R x  $2$NC";;
 | 
						|
    "warn")  echo -e "$Y ⚠  $2$NC";;
 | 
						|
    "info")  echo -e "$G ✔  $2$NC";;
 | 
						|
    *) echo -e "$1: $2";;
 | 
						|
  esac
 | 
						|
}
 | 
						|
 | 
						|
if [[ -z $2 ]] ; then
 | 
						|
  case "$LAST_RETURN" in
 | 
						|
    0) format info $1;;
 | 
						|
    *) format error "FAILURE DURING: \"$1\"";;
 | 
						|
  esac
 | 
						|
else
 | 
						|
  format $1 $2
 | 
						|
fi
 |