def show_help(self):
help = 'dashboard section:\n'
help += ' show interfaces : Print all interfaces found by cmanager\n'
help += ' wizard wifi : Go to wifi wizard section\n'
help += ' exit : Exit cmanager\n\n'
help += 'wifi-wizard section:\n'
help += ' show profile : List profile that saved by cmanager\n'
help += ' show options : List available options used to create a profile\n'
help += ' set [options] [value] : Set value to available options before save the profile\n'
help += ' save profile : Save profile after options data\'s been filled\n'
help += ' del profile [profile] : Del profile by profile\'s name\n'
help += ' use [wireless_intarface] : Use this command BEFORE scanning available network or connecting a profile\n'
help += ' scan : Scanning available networks\n'
help += ' connect [profile] : Connecting wireless interface to a wifi network using specified profile\'s name\n'
help += ' back : Back to dashboard section'
print (Fore.GREEN + Style.BRIGHT + help)
python类Back()的实例源码
def _get_color_printer(stream=sys.stdout, colors=True):
"""
Return a print function tied to a particular stream, along with coloring info.
"""
try:
from colorama import init, Fore, Back, Style
init(autoreset=True)
except ImportError:
Fore = Back = Style = _NoColor()
if not colors:
Fore = Back = Style = _NoColor()
def color_print(s, fore='', color='', end=''):
"""
"""
print(color + s, file=stream, end='')
print(Style.RESET_ALL, file=stream, end='')
print(end=end)
return color_print, Fore, Back, Style
def print_match(match, template):
"""wrapper to inject colorama colors to template"""
click.echo(template.render(match, Fore=Fore, Back=Back))
def init():
try:
import colorama
global Fore, Back, Style
Fore = colorama.Fore
Back = colorama.Back
Style = colorama.Style
colorama.Fore
except ImportError:
pass