def show_menu(): cc.v('') cc.v('=========================================================') for o in range(len(options)): if options[o] is None: cc.v(' -------------------------------------------------------') continue cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, '%2d' % options[o]['id']), (cc.CR_NORMAL, '] ', options[o]['disp'])) cc.v(' -------------------------------------------------------') cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' E'), (cc.CR_NORMAL, '] clean external temp. files.')) cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' C'), (cc.CR_NORMAL, '] clean build and dist.')) cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' A'), (cc.CR_NORMAL, '] clean everything.')) cc.v(' -------------------------------------------------------') cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' Q'), (cc.CR_NORMAL, '] exit')) cc.w('\nselect action: ', end='') try: x = _input() except EOFError: x = 'q' cc.n('') return x.lower()
def show_menu(): cc.v('\n=====================[ MENU ]===============================') for o in options: if o['id'] == '--SPLIT-LINE--': if o['title'] is not None: cc.w('\n {}:'.format(o['title'])) else: cc.v('\n ----------------------------------------------------------') continue cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, '%2d' % o['id']), (cc.CR_NORMAL, '] ', o['disp'])) cc.v('\n ----------------------------------------------------------') cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' Q'), (cc.CR_NORMAL, '] exit')) cc.w('\nselect action: ', end='') try: x = input() except EOFError: x = 'q' cc.n('') return x.lower()
def show_menu(): cc.v('') cc.v('=========================================================') for o in range(len(options)): if options[o] is None: cc.v(' -------------------------------------------------------') continue cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, '%2d' % options[o]['id']), (cc.CR_NORMAL, '] ', options[o]['disp'])) cc.v(' -------------------------------------------------------') cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' C'), (cc.CR_NORMAL, '] clean build and dist.')) cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' A'), (cc.CR_NORMAL, '] clean everything.')) cc.v(' -------------------------------------------------------') cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' Q'), (cc.CR_NORMAL, '] exit')) cc.w('\nselect action: ', end='') try: x = _input() except EOFError: x = 'q' cc.n('') return x.lower()
def show_logo(): cc.v('[]=======================================================[]') cc.o((cc.CR_VERBOSE, ' | '), (cc.CR_INFO, 'Teleport Projects Builder'), (cc.CR_VERBOSE, ' |')) cc.v(' | auth: [email protected] |') cc.v('[]=======================================================[]')
def main(): cc.set_default(sep='', end='\n') if not env.init(warn_miss_tool=True): return action = None argv = sys.argv[1:] if len(argv) >= 1: for i in range(len(argv)): if 'debug' == argv[i]: ctx.set_target(TARGET_DEBUG) elif 'release' == argv[i]: ctx.set_target(TARGET_RELEASE) elif argv[i] in ctx.dist_all: ctx.set_dist(argv[i]) else: action = argv[i] make_options() if action is not None: if action == '-h' or action == '--help': max_name_len = 0 for x in options: if x['id'] != '--SPLIT-LINE--': max_name_len = max(len(x['name']), max_name_len) max_name_len += 4 for x in options: if x['id'] != '--SPLIT-LINE--': name_pad = max_name_len - len(x['name']) cc.o((cc.CR_INFO, x['name']), (cc.CR_VERBOSE, ' ' * name_pad), (cc.CR_VERBOSE, x['disp'])) return # cc.v(action) opt = select_option_by_name(action) if opt is None: cc.e('unknown config: ', action) return do_opt(opt) return show_logo() while True: x = show_menu() if x == 'q': break try: x = int(x) except: cc.e('invalid input.') continue opt = select_option_by_id(int(x)) # if 'config' == opt['name']: # if make_config(): # make_options() # continue if opt is None: cc.e('unknown selection: ', x) continue do_opt(opt) cc.w('\ntask finished, press Enter to continue or Q to quit...', end='') try: x = input() except EOFError: x = 'q' if x == 'q': break