Ejemplo n.º 1
0
 def select_alias(self):
     try:
         return terminal.select_string(
             u"Enter the alias for .tksrc (a-z, - and _ allowed), (Ctrl-C)"
             " to exit: ", r'^[\w-]+$')
     except KeyboardInterrupt:
         raise CancelException()
Ejemplo n.º 2
0
    def overwrite_alias(self, alias, mapping, retry=True):
        mapping_name = Project.tuple_to_str(mapping)

        if retry:
            choices = 'y/n/R(etry)'
            default_choice = 'r'
            choice_regexp = r'^[ynr]$'
        else:
            choices = 'y/N'
            default_choice = 'n'
            choice_regexp = r'^[yn]$'

        s = (u"The alias `%s` is already mapped to `%s`.\nDo you want to "
             "overwrite it [%s]? " % (alias, mapping_name, choices))

        overwrite = terminal.select_string(
            s, choice_regexp, re.I, default_choice
        )

        if overwrite == 'n':
            return False
        elif overwrite == 'y':
            return True

        return None
Ejemplo n.º 3
0
    def clean_inactive_aliases(self, aliases):
        self.msg(u"The following aliases are mapped to inactive projects:\n")

        for (mapping, project) in aliases:
            self.alias_detail(mapping, project)

        confirm = terminal.select_string(
            u"\nDo you want to clean them [y/N]? ", r'^[yn]$', re.I, 'n')

        return confirm == 'y'