From 71af58d5f4d37565365b95c866cf7edb9d7b7a85 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 22 Jun 2016 21:15:24 +0200 Subject: [PATCH] bcolors simple implementation --- socli/socli.py | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/socli/socli.py b/socli/socli.py index 478f0d6..3e15aca 100644 --- a/socli/socli.py +++ b/socli/socli.py @@ -11,6 +11,21 @@ ir = 0 # interactive mode off (for -i arg) query = "" + + +class bcolors: + ''' use: print(bcolors.WARNING + "text here" + bcolors.ENDC) ''' + HEADER = '\033[95m' + OKBLUE = '\033[94m' + OKGREEN = '\033[92m' + WARNING = '\033[93m' + FAIL = '\033[91m' + ENDC = '\033[0m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + + + # @param searchquery = Query to search on stackoverflow def socli(query): query = urllib.parse.quote_plus(query) @@ -31,7 +46,7 @@ def socli(query): # Displays help def helpman(): - print("Stack Overflow command line client:") + print(bcolors.HEADER + "Stack Overflow command line client:" + bcolors.ENDC) print("\n\n\tUsage: socli [ Arguments ] < Search Query >\n\n") print("\n[ Arguments ] (optional):\n") print("--help or -h: Displays this help") @@ -63,13 +78,14 @@ def socli_interactive(query): tmp1 = (soup.find_all("div", class_="excerpt")) i=0 question_local_url=[] - print("\nSelect a question below:\n") + #bcolors.UNDERLINE + "text here" + bcolors.ENDC + print(bcolors.UNDERLINE + "\nSelect a question below:\n" + bcolors.ENDC) while (i