Compare commits

..

No commits in common. "391b85bea508ef6a0911f777dbf69cf614187e4c" and "fdb5d070e4287030dcfcecde62db4abe121cd740" have entirely different histories.

2 changed files with 15 additions and 33 deletions

View File

@ -1,4 +1,3 @@
for source in $(find "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -type f | grep -Ev "_all|terminal_fancyfying"); do for source in $(find "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -type f | grep -v "_all"); do
. "${source}" . "${source}"
done done
. "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)/terminal_fancyfying_${TERMINAL_FANCYFY}"

View File

@ -1,28 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
THIS="$(dirname "$(readlink -fm "$0")")" THIS="$(dirname "$(readlink -fm "$0")")"
FANCYFY="client" SERVER=false
CURRENT_FANCYFY=""
DELETE=false DELETE=false
MOVE=false MOVE=false
PRESENT=false
_bashrc_present() {
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
echo true
exit
fi
echo false
}
_arguments() { _arguments() {
if [ "$(_bashrc_present)" = true ]; then
PRESENT=true
CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY /home/bryanpedini/.bashrc | sed 's/.*=//')"
fi
for PARM in "$@"; do for PARM in "$@"; do
if [ "${PARM}" = "--server" ]; then if [ "${PARM}" = "--server" ]; then
FANCYFY="server" SERVER=true
elif [ "${PARM}" = "--delete" ]; then elif [ "${PARM}" = "--delete" ]; then
DELETE=true DELETE=true
elif [ "${PARM}" = "--move" ]; then elif [ "${PARM}" = "--move" ]; then
@ -52,12 +38,12 @@ _help() {
} }
_delete() { _delete() {
sed -i '/REF:bashrc_overrides:REF/{N;N;d}' ~/.bashrc sed -i '/REF:bashrc_overrides:REF/{N;d}' ~/.bashrc
} }
_bashrc_ref() { _bashrc_ref() {
echo "#REF:bashrc_overrides:REF" >> ~/.bashrc echo "#REF:bashrc_overrides:REF" >> ~/.bashrc
echo "export TERMINAL_FANCYFY=${1}" >> ~/.bashrc echo "export TERMINAL_FANCYFY=client" >> ~/.bashrc
echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc
} }
@ -71,26 +57,23 @@ _main() {
if [ "${DELETE}" = true ]; then if [ "${DELETE}" = true ]; then
_delete _delete
echo "removed custom configs"
elif [ "${MOVE}" = true ]; then elif [ "${MOVE}" = true ]; then
_move _move
echo "moved custom config directory to ${THIS}" elif [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
echo
elif [ "${PRESENT}" = true ]; then
if [ "${CURRENT_FANCYFY}" != "${FANCYFY}" ]; then
sed -i "s/TERMINAL_FANCYFY=${CURRENT_FANCYFY}/TERMINAL_FANCYFY=${FANCYFY}/" ~/.bashrc
echo "customized fancyfying"
echo
else
echo "bash overrides already in place" echo "bash overrides already in place"
echo "skipping..." echo "skipping..."
echo echo
fi
else else
_bashrc_ref "${FANCYFY}" _bashrc_ref
echo "bash overrides added" echo "bash overrides added"
echo echo
fi fi
if [ "${SERVER}" = true ]; then
sed -i 's/terminal_fancyfying/terminal_fancyfying_server/' ${THIS}/bashrc_overrides/_all
else
sed -i 's/terminal_fancyfying_server/terminal_fancyfying/' ${THIS}/bashrc_overrides/_all
fi
} }
_main "$@" _main "$@"