Skip to content

Commit

Permalink
WIP: Highlights errors on the console.
Browse files Browse the repository at this point in the history
git-svn-id: svn://cherokee-project.com/wizards2@6806 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Aug 15, 2011
1 parent 22c0a2f commit e56a859
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions cherokee-wizard
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,34 @@ USAGE = \
"Report bugs to http://bugs.cherokee-project.com\n"


# ANSI Colors
#
ESC = chr(27) + '['
RESET = '%s0m' %(ESC)

def green (s): return ESC + '0;32m' + s + RESET
def red (s): return ESC + '0;31m' + s + RESET
def yellow (s): return ESC + '1;33m' + s + RESET
def blue (s): return ESC + '0;34m' + s + RESET


# Util
#
def print_error (msg, severity="ERROR"):
sys.stdout.write ("%s: %s\n" %(red(severity), msg))
sys.stdout.flush ()


# Installer
#
def install (wizard_path, params):
# Log
Install_Log.only_print = True

# Load the module
mod = Wizard2.Load_Module (wizard_path)
if not mod:
print "ERROR: Could not load '%s'" %(wizard_path)
print_error ("Could not load '%s'" %(wizard_path))
return 1

# Launch the wizard
Expand All @@ -63,10 +83,10 @@ def install (wizard_path, params):
errors = phase()
if errors:
for err in set(errors):
print err
print_error (err)
return 1

print "ok"
print yellow("ok")

# Save the config
CTK.cfg.save()
Expand Down

0 comments on commit e56a859

Please sign in to comment.