Created
October 10, 2019 20:50
-
-
Save qodeninja/fbc44715e8771b0dc9b17ed3f441c86b to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
#=============================================================================== | |
## __ ____ | |
## / /_ ___ / / /___ _ __ | |
## / __ \/ _ \/ / / __ \ | /| / / | |
## / / / / __/ / / /_/ / |/ |/ / | |
## /_/ /_/\___/_/_/\____/|__/|__/ | |
## | |
#------------------------------------------------------------------------------- | |
#=====================================code!===================================== | |
#------------------------------------------------------------------------------- | |
red=$(tput setaf 202) | |
green=$(tput setaf 2) | |
blue=$(tput setaf 12) | |
orange=$(tput setaf 214) | |
grey=$(tput setaf 247) | |
purple=$(tput setaf 213) | |
x=$(tput sgr0) | |
b=$blue g=$green o=$orange w=$grey | |
m_str= | |
m_end= | |
tab=$'\t'; | |
nl=$'\n'; | |
rl=$'\r'; | |
sp=$' '; | |
logo=$(sed -n '3,8 p' $BASH_SOURCE) | |
logo=${logo//#/ }; | |
printf "$logo$nl" | |
sed_block(){ | |
local id="$1" pre="^[#]+[=]+" post=".*" str end; | |
str="${pre}${id}[:]?[^\!=\-]*\!${post}"; | |
end="${pre}\!${id}[:]?[^\!=\-]*${post}"; | |
sed -rn "1,/${str}/d;/${end}/q;p" $BASH_SOURCE | tr -d '#'; | |
} | |
block_parse(){ | |
local lbl="$1" IFS res; | |
res=$(sed_block $lbl); | |
if [ ${#res} -gt 0 ]; then | |
while IFS= read -r line; do | |
[[ $lbl =~ doc*|inf* ]] && line=$(eval "echo -e \"$line\""); | |
echo "$line" | |
done <<< "$res"; | |
else | |
return 1; | |
fi | |
} | |
block_parse 'doc:help'; | |
#------------------------------------------------------------------------------- | |
#=====================================!code===================================== | |
#====================================doc:help!================================== | |
# | |
# \n\t${b}hellow --option [<n>ame] [<p>ath]${x} | |
# | |
# \t${w}Find:${x} | |
# | |
# \t --hi <?> ${b}Say Hello!${x} | |
# \t --no <p> ${b}Dont Say Hello!${x} | |
# \t --kk <p> ${b}Thumbs up!${x} | |
# | |
#=================================!doc:help===================================== | |
#==================================info:todo!=================================== | |
# x | |
# c | |
# Hey girl hey, today is a magical day! | |
# Careful no code in here! | |
# x | |
# c | |
#===================================!info:todo================================== | |
#=====================================code:yay!=================================== | |
# if [ -n "\$(which hellow)" ]; then | |
# hola(){ | |
# local this=\$(hellow -hi \$1); | |
# [ -d "\$this" ] && { cd "\$this"; echo -e "\\\\n[${green}#\$1${x}] \$this\\\\n"; ls -la; } | |
# } | |
# fi | |
#=====================================!code:yay=================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment