aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-01-12 21:42:58 +0000
committerterminaldweller <thabogre@gmail.com>2022-01-12 21:42:58 +0000
commitbecf18963fbc1dd049f29799d433f3d0b0f27b7b (patch)
tree76e34c5be67e14268ae9d14072148acf6aa6e6ba
parentfixes, updates (diff)
downloadkaminokumo-becf18963fbc1dd049f29799d433f3d0b0f27b7b.tar.gz
kaminokumo-becf18963fbc1dd049f29799d433f3d0b0f27b7b.zip
added isatty for colors outputs.
-rwxr-xr-xkaminokumo11
1 files changed, 6 insertions, 5 deletions
diff --git a/kaminokumo b/kaminokumo
index a347c26..aa94a56 100755
--- a/kaminokumo
+++ b/kaminokumo
@@ -22,6 +22,11 @@ class bcolors:
UNDERLINE = "\033[4m"
+green = bcolors.OKGREEN if sys.stdout.isatty() else ""
+blue = bcolors.OKBLUE if sys.stdout.isatty() else ""
+cyan = bcolors.OKCYAN if sys.stdout.isatty() else ""
+
+
class Argparser(object):
def __init__(self):
parser = argparse.ArgumentParser()
@@ -106,11 +111,7 @@ def manga_scrape():
for thing in search:
# re_res.append(re.findall("Chapter [0-9]*[.[0-9]*]?", thing.text))
re_res.append(
- bcolors.OKGREEN
- + thing["title"]
- + " >>> "
- + bcolors.OKCYAN
- + thing["href"]
+ green + thing["title"] + " >>> " + blue + thing["href"]
)
try:
# result += name + "-->" + re_res[0][0] + "\n"