Show
Ignore:
Timestamp:
17/04/09 14:11:50 (16 months ago)
Author:
athomas
Message:

Add support for console codes to the prompt.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cly/trunk/cly/console.py

    r590 r600  
    3737cwrite getch cerror cfatal register_codec cinfo cjustify clen cprint cprintstrip 
    3838csplice cwarning cwraptext print_table rjustify termheight termwidth wraptoterm 
     39cencode cdecode 
    3940""".split() 
    4041 
     
    310311        return (_encode, _decode, _CodecStreamReader, _CodecStreamWriter) 
    311312    return codecs.register(inner_register) 
     313 
     314 
     315def cencode(text): 
     316    """Encode to CLY colour-encoded text.""" 
     317    return _encode(text)[0] 
     318 
     319 
     320def cdecode(text): 
     321    """Decode CLY colour-encoded text. 
     322 
     323    Use this to convert '^Bfoo^N' to the ANSI equivalent. 
     324    """ 
     325    return _decode(text)[0] 
    312326 
    313327