-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update: add hop proxy command * update: output a proxy URL link * fix: option entry not shifting past value * fix: uncomment actual proxy command * style: fix some lint issues * style: fix more lint issues * style: fix more lint issues * style: fix more lint issues * update: allow selection of specific host when multiple domains are defined in VIRTUAL_HOST
- Loading branch information
Showing
3 changed files
with
375 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Script Output | ||
# | ||
|
||
# Determine width of the program | ||
ACTUAL_WIDTH=$(($(tput cols) - 2)) | ||
MAX_WIDTH=100 | ||
|
||
if test "$ACTUAL_WIDTH" -gt "$MAX_WIDTH"; then | ||
WIDTH=$MAX_WIDTH | ||
else | ||
WIDTH=$ACTUAL_WIDTH | ||
fi | ||
|
||
declare BG_R | ||
declare BG_G | ||
declare BG_Y | ||
declare BG_B | ||
declare BG_M | ||
declare BG_C | ||
declare BG_N | ||
|
||
declare FG_R | ||
declare FG_G | ||
declare FG_Y | ||
declare FG_B | ||
declare FG_M | ||
declare FG_C | ||
declare FG_N | ||
|
||
declare BOLD | ||
declare RESET | ||
|
||
# Setup Color Outputs | ||
if test -t 1; then | ||
ncolors=$(tput colors) | ||
|
||
if test -n "$ncolors" && test "$ncolors" -ge 8; then | ||
COLOR_R=1 # color code - RED | ||
COLOR_G=2 # color code - GREEN | ||
COLOR_Y=3 # color code - YELLOW | ||
COLOR_B=4 # color code - BLUE | ||
COLOR_M=5 # color code - MAGENTA | ||
COLOR_C=6 # color code - CYAN | ||
COLOR_N=246 # color code - NEUTRAL (GRAY) | ||
|
||
BG_R="$(tput setab $COLOR_R)" # Background - RED | ||
BG_G="$(tput setab $COLOR_G)" # Background - GREEN | ||
BG_Y="$(tput setab $COLOR_Y)" # Background - YELLOW | ||
BG_B="$(tput setab $COLOR_B)" # Background - BLUE | ||
BG_M="$(tput setab $COLOR_M)" # Background - MAGENTA | ||
BG_C="$(tput setab $COLOR_C)" # Background - CYAN | ||
BG_N="$(tput setab $COLOR_N)" # Background - NEUTRAL (GRAY) | ||
|
||
FG_R="$(tput setaf $COLOR_R)" # Foreground - RED | ||
FG_G="$(tput setaf $COLOR_G)" # Foreground - GREEN | ||
FG_Y="$(tput setaf $COLOR_Y)" # Foreground - YELLOW | ||
FG_B="$(tput setaf $COLOR_B)" # Foreground - BLUE | ||
FG_M="$(tput setaf $COLOR_M)" # Foreground - MAGENTA | ||
FG_C="$(tput setaf $COLOR_C)" # Foreground - CYAN | ||
FG_N="$(tput setaf $COLOR_N)" # Foreground - NEUTRAL (GRAY) | ||
|
||
BOLD="$(tput bold)" | ||
RESET="$(tput sgr0)" | ||
fi | ||
fi | ||
|
||
function join { | ||
local IFS="$1" | ||
shift | ||
echo "$*" | ||
} | ||
|
||
function tag { | ||
local STYLE=$1 | ||
local LABEL=$2 | ||
shift 2 | ||
|
||
echo "$@" "${STYLE} ${LABEL} ${RESET} " | ||
} | ||
|
||
function output_tagged_string() { | ||
tag "$1" "$2" -n | ||
echo "$3" | ||
} | ||
|
||
function output_error { | ||
output_tagged_string "$BG_R" "ERROR" "$1" | ||
} | ||
|
||
function output_info { | ||
output_tagged_string "$BG_B" "INFO" "$1" | ||
} | ||
|
||
export BG_R | ||
export BG_G | ||
export BG_Y | ||
export BG_B | ||
export BG_M | ||
export BG_C | ||
export BG_N | ||
|
||
export FG_R | ||
export FG_G | ||
export FG_Y | ||
export FG_B | ||
export FG_M | ||
export FG_C | ||
export FG_N | ||
|
||
export BOLD | ||
export RESET | ||
|
||
export WIDTH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.