Skip to content

Commit

Permalink
add - Added printing without color
Browse files Browse the repository at this point in the history
---

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
  • Loading branch information
AptiviCEO committed Oct 9, 2024
1 parent e69ce3f commit 1b7f58a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/bskyid
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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 <handle> [-plain]\n" >&2
printf "Usage: $0 <handle> [-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
Expand Down

0 comments on commit 1b7f58a

Please sign in to comment.