From 1b7f58a739db41b28da43d40743549d5a0c356dd Mon Sep 17 00:00:00 2001 From: Aptivi Date: Wed, 9 Oct 2024 12:49:25 +0300 Subject: [PATCH] add - Added printing without color --- If you want to print without color, we've added the -nocolor argument for the Bash version of the script. --- Type: add Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- src/bskyid | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/bskyid b/src/bskyid index 5cab1db..1e63e9e 100755 --- a/src/bskyid +++ b/src/bskyid @@ -19,9 +19,10 @@ # Some variables ADDRESS="https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=" -GREEN=$(tput setaf 2 > /dev/null 2>&1) -RED=$(tput setaf 1 > /dev/null 2>&1) -RESET=$(tput sgr0 > /dev/null 2>&1) +GREEN=$(tput setaf 2 2>/dev/null) +RED=$(tput setaf 1 2>/dev/null) +RESET=$(tput sgr0 2>/dev/null) +PLAIN=0 # Convenience functions checkerror() { @@ -33,16 +34,21 @@ checkerror() { } # Check for arguments -PLAIN=0 if [[ "$#" -le 0 ]] then printf "${RED}Handle is required.${RESET}\n" >&2 - printf "Usage: $0 [-plain]\n" >&2 + printf "Usage: $0 [-plain/-nocolor]\n" >&2 exit 1 fi for SWITCH in "$@" do - test "$2" == "-plain" && PLAIN=1 + test "$SWITCH" == "-plain" && PLAIN=1 + if [ "$SWITCH" == "-nocolor" ] + then + GREEN="" + RED="" + RESET="" + fi done # Actual code