def value(self, v): if self.__data_type is bool: self.__value = positive(v) else: try: self.__value = self.__data_type(v) except: log.err('Option error - cannot cast \'%s\' to %s' % (v, self.__data_type))
def debug_query(string=''): if positive(config['debug.query'].value): show_marked('qry.', COLOR_DARK_GREY, COLOR_DARK_GREY + str(string) + COLOR_NONE)
def debug_error(string=''): if positive(config['debug.errors'].value): err('See traceback:') traceback.print_exc()
def debug_config(string=''): if positive(config['debug.config'].value): show_marked('cnf.', COLOR_DARK_GREY, COLOR_DARK_GREY + str(string) + COLOR_NONE)
log.info( 'Welcome! Create new ring using `ra` or choose an ' 'existing one with `rs <name>`.') ring_lens = commands.get_format_len_ring(rings) log.info('Existing rings:') for ring in rings: log.info(' '+commands.format_ring(*ring, *ring_lens)) else: log.info( 'Welcome! It looks that you do not have any rings created. ' 'To do this, use `ra`.') while True: # get command try: cmd = input(log.prompt).strip() except EOFError: # Ctrl+D -> quit log.newline() lib.exit_program(None, None) if len(cmd) == 0: continue # quit? if lib.quitstring(cmd): log.warn('Do you really want to quit? ', new_line=False) if lib.positive(input()): lib.exit_program(None, None) # do command else: commands.run_command(cmd)