11#! /usr/bin/env bash
22
3- HOP_PATH=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
3+ HOP_PATH=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
44TOOLKIT_PATH=$( dirname " $HOP_PATH " )
55
6- #
7- # Script Output
8- #
9-
10- # Determine width of the program
11- ACTUAL_WIDTH=$(( $(tput cols) - 2 ))
12- MAX_WIDTH=100
13-
14- if test " $ACTUAL_WIDTH " -gt " $MAX_WIDTH " ; then
15- WIDTH=$MAX_WIDTH
16- else
17- WIDTH=$ACTUAL_WIDTH
18- fi
19-
20- # Setup Color Outputs
21- if test -t 1; then
22- ncolors=$( tput colors)
23-
24- if test -n " $ncolors " && test " $ncolors " -ge 8; then
25- COLOR_R=1 # color code - RED
26- COLOR_G=2 # color code - GREEN
27- COLOR_Y=3 # color code - YELLOW
28- COLOR_B=4 # color code - BLUE
29- COLOR_M=5 # color code - MAGENTA
30- COLOR_C=6 # color code - CYAN
31- COLOR_N=246 # color code - NEUTRAL (GRAY)
32-
33- BG_R=" $( tput setab $COLOR_R ) " # Background - RED
34- BG_G=" $( tput setab $COLOR_G ) " # Background - GREEN
35- BG_Y=" $( tput setab $COLOR_Y ) " # Background - YELLOW
36- BG_B=" $( tput setab $COLOR_B ) " # Background - BLUE
37- # BG_M="$(tput setab $COLOR_M)" # Background - MAGENTA
38- # BG_C="$(tput setab $COLOR_C)" # Background - CYAN
39- # BG_N="$(tput setab $COLOR_N)" # Background - NEUTRAL (GRAY)
40-
41- # FG_R="$(tput setaf $COLOR_R)" # Foreground - RED
42- # FG_G="$(tput setaf $COLOR_G)" # Foreground - GREEN
43- # FG_Y="$(tput setaf $COLOR_Y)" # Foreground - YELLOW
44- # FG_B="$(tput setaf $COLOR_B)" # Foreground - BLUE
45- FG_M=" $( tput setaf $COLOR_M ) " # Foreground - MAGENTA
46- FG_C=" $( tput setaf $COLOR_C ) " # Foreground - CYAN
47- FG_N=" $( tput setaf $COLOR_N ) " # Foreground - NEUTRAL (GRAY)
48-
49- BOLD=" $( tput bold) "
50- RESET=" $( tput sgr0) "
51- fi
52- fi
53-
54- function join {
55- local IFS=" $1 "
56- shift
57- echo " $* "
58- }
6+ source " $TOOLKIT_PATH /bin/_helpers"
597
608function describe_command {
619 local COMMAND_NAME=$1
@@ -79,19 +27,6 @@ function describe_command {
7927 join " " " ${SEGMENTS[@]} " " ${RESET} "
8028}
8129
82- function tag {
83- local STYLE=$1
84- local LABEL=$2
85- shift 2
86-
87- echo " $@ " " ${STYLE} ${LABEL} ${RESET} "
88- }
89-
90- function output_error {
91- tag " $BG_R " " ERROR" -n
92- echo " $1 "
93- }
94-
9530EXPLAIN_COUNT=0
9631function explain {
9732 EXPLAIN_COUNT=$(( EXPLAIN_COUNT + 1 ))
@@ -159,6 +94,9 @@ function display_help {
15994 describe_command " seed" " hop artisan db:seed"
16095 describe_command " test" " hop artisan test"
16196 describe_command " tinker" " hop artisan tinker"
97+ echo
98+ tag " $BG_Y$BOLD " " Commands"
99+ describe_command " proxy" " \$ @" " Start a proxy for this project."
162100}
163101
164102if [ $# -lt 1 ] || [ " $1 " == " help" ] || [ " $1 " == " -h" ] || [ " $1 " == " -help" ] || [ " $1 " == " --help" ]; then
@@ -411,6 +349,10 @@ case $1 in
411349 shift 1
412350 run_exec_command php vendor/bin/pint
413351 ;;
352+ " proxy" )
353+ shift 1
354+ bash " $TOOLKIT_PATH /bin/proxy" " $@ "
355+ ;;
414356 " ps" |" status" )
415357 shift 1
416358 run_command ps " $@ "
0 commit comments