refactor: switch to huepy from pip
Anirudh icyph0x@protonmail.com
Sat, 14 Apr 2018 10:17:27 +0530
3 files changed,
4 insertions(+),
53 deletions(-)
D
vite/hue.py
@@ -1,48 +0,0 @@
-#!/usr/bin/env python - -COMMANDS = { - # Lables - 'info': (33, '[!] '), - 'que': (34, '[?] '), - 'bad': (31, '[-] '), - 'good': (32, '[+] '), - 'run': (97, '[~] '), - - # Colors - 'green': 32, - 'lightgreen': 92, - 'grey': 37, - 'black': 30, - 'red': 31, - 'lightred': 91, - 'cyan': 36, - 'lightcyan': 96, - 'blue': 34, - 'lightblue': 94, - 'purple': 35, - 'yellow': 93, - 'white': 97, - 'lightpurple': 95, - 'orange': 33, - - # Styles - 'bg': ';7', - 'bold': ';1', - 'italic': '3', - 'under': '4', - 'strike': '09', -} - - -def _gen(string, prefix, key): - colored = prefix if prefix else string - not_colored = string if prefix else '' - return '\033[{}m{}\033[0m{}'.format(key, colored, not_colored) - - -for key, val in COMMANDS.items(): - value = val[0] if isinstance(val, tuple) else val - prefix = val[1] if isinstance(val, tuple) else '' - locals()[key] = lambda s, prefix=prefix, key=value: _gen(s, prefix, key) - -__all__ = list(COMMANDS.keys())
M
vite/make.py
→
vite/make.py
@@ -6,7 +6,7 @@ import jinja2
import time from markdown2 import markdown_path -from hue import * +from huepy import * # import config file try:
M
vite/vite.py
→
vite/vite.py
@@ -8,9 +8,8 @@ import sys
import argparse import pathlib import os -import importlib -from hue import * +from huepy import * parser = argparse.ArgumentParser(description=""" A simple and minimal static site generator.@@ -87,8 +86,8 @@
def build_project(path): try: os.chdir(path) - importlib.import_module('make') - except FileNotFoundError as e: + import make + except FileNotFoundError: print(bad('Error: no such file or directory: %s' % (path)))