def select_command(corrected_commands):
 try:
  selector = CommandSelector(corrected_commands)
 except NoRuleMatched:
  logs.failed('No fucks given')
  return
 if (not settings.require_confirmation):
  logs.show_corrected_command(selector.value)
  return selector.value
 logs.confirm_text(selector.value)
 for action in read_actions():
  if (action == const.ACTION_SELECT):
   sys.stderr.write('\n')
   return selector.value
  elif (action == const.ACTION_ABORT):
   logs.failed('\nAborted')
   return
  elif (action == const.ACTION_PREVIOUS):
   selector.previous()
   logs.confirm_text(selector.value)
  elif (action == const.ACTION_NEXT):
   selector.next()
   logs.confirm_text(selector.value)

def select_command ( corrected_commands ) : try : selector = CommandSelector ( corrected_commands ) except NoRuleMatched : logs . failed ( 'No fucks given' ) return if ( not settings . require_confirmation ) : logs . show_corrected_command ( selector . value ) return selector . value logs . confirm_text ( selector . value ) for action in read_actions ( ) : if ( action == const . ACTION_SELECT ) : sys . stderr . write ( '\n' ) return selector . value elif ( action == const . ACTION_ABORT ) : logs . failed ( '\nAborted' ) return elif ( action == const . ACTION_PREVIOUS ) : selector . previous ( ) logs . confirm_text ( selector . value ) elif ( action == const . ACTION_NEXT ) : selector . next ( ) logs . confirm_text ( selector . value )
returns: - the first command when confirmation disabled; - none when ctrl+c pressed; - selected command .