# Path: engine/colors.py
# class bcolors:
#     HEADER = '\033[95m'
#     OKBLUE = '\033[94m'
#     OKGREEN = '\033[92;1m'
#     WARNING = '\033[93m'
#     FAIL = '\033[91m'
#     ENDC = '\033[0m'
#     BOLD = '\033[1m'
#     UNDERLINE = '\033[4m'
# 
# Path: engine/conf.py
# PATH_TO_MD = PATH + '/notes/'


import os
import sys
import re
from engine.colors import bcolors
from engine.conf import PATH_TO_MD
    # if action == 'search':
    if 1:
        ################################################################################
        # for
        if ' '.join(sys.argv[:]).find('for') == -1:
            raise Exception('Missing for in your query')
        if v:
            print (bcolors.OKGREEN + '> action:' + action + bcolors.ENDC)
        match = re.search('for (?P<for>.*)', ' '.join(sys.argv[:]))
        f = match.group('for').split('in')[0]
        if v:
            print (bcolors.OKGREEN + '\_ for:' + f + bcolors.ENDC)

        ################################################################################
        match = re.search('in (?P<in>.*)', ' '.join(sys.argv[:]))
        if match:
            searchin = match.group('in').strip().split(' n ')[0]
        else:
            searchin = '*'

        # -n forr grep
        match = re.search('n (?P<n>\d+)', ' '.join(sys.argv[:]))
        if match:
            n = match.group('n').strip()
        else:
            n = '0'
        if v:
            print (bcolors.OKGREEN + '\_ n:' + n + bcolors.ENDC)

        if v:

# Path: engine/colors.py
# class bcolors:
#     HEADER = '\033[95m'
#     OKBLUE = '\033[94m'
#     OKGREEN = '\033[92;1m'
#     WARNING = '\033[93m'
#     FAIL = '\033[91m'
#     ENDC = '\033[0m'
#     BOLD = '\033[1m'
#     UNDERLINE = '\033[4m'
# 
# Path: engine/conf.py
# PATH_TO_MD = PATH + '/notes/'


# Path: geekbooksearch2.py
import os
import sys
import re
from engine.colors import bcolors
from engine.conf import PATH_TO_MD

    # if action == 'search':
    if 1:
        ################################################################################
        # for
        if ' '.join(sys.argv[:]).find('for') == -1:
            raise Exception('Missing for in your query')
        if v:
            print (bcolors.OKGREEN + '> action:' + action + bcolors.ENDC)
        match = re.search('for (?P<for>.*)', ' '.join(sys.argv[:]))
        f = match.group('for').split('in')[0]
        if v:
            print (bcolors.OKGREEN + '\_ for:' + f + bcolors.ENDC)

        ################################################################################
        match = re.search('in (?P<in>.*)', ' '.join(sys.argv[:]))
        if match:
            searchin = match.group('in').strip().split(' n ')[0]
        else:
            searchin = '*'

        # -n forr grep
        match = re.search('n (?P<n>\d+)', ' '.join(sys.argv[:]))
        if match:
            n = match.group('n').strip()
        else:
            n = '0'
        if v:
            print (bcolors.OKGREEN + '\_ n:' + n + bcolors.ENDC)

        if v:

            print (bcolors.OKGREEN + '\_ in: ' + searchin[:200] + bcolors.ENDC)