Exemple #1
0
 def execute(self, name):
     tags = TagStorage()
     path = tags['tags'].pop(name, None)
     if path:
         qq.output('Untagged folder {} with name "{}"'.format(path, name))
     else:
         qq.output('Tag not found: ' + name)
     return True
Exemple #2
0
 def execute(self, name):
     tags = TagStorage()
     if name not in tags['tags']:
         qq.output('Tag not found: ' + name)
         return False
     path = tags['tags'][name]
     qq.shell_execute('cd "{}"'.format(path))
     qq.output('Changing to tagged folder "{}" ({})'.format(name, path))
     return True
Exemple #3
0
 def execute(self, pattern=None):
     tags = TagStorage()
     pattern = pattern or '.*'
     qq.output('Tagged folders matching the pattern {}:'.format(pattern))
     if len(tags['tags']) == 0:
         print(' No tags found.')
     else:
         for name, path in tags['tags'].iteritems():
             print(' * {0} ({1})'.format(name, path))
     return True
Exemple #4
0
 def execute(self, pattern=None):
     commands = qq.find_commands()
     pattern = pattern or '.*'
     qq.output('Commands matching the pattern ' + pattern + ':')
     found = False
     for key in sorted(commands.iterkeys()):
         if re.match(pattern, key):
             found = True
             qq.output(' * {0} ({1})'.format(key, commands[key].shorttext))
     if not found:
         print(' No commands found.')
     return True
Exemple #5
0
    def execute(self, *args):
        if len(args) == 1:
            path = os.getcwd()
            name = args[0]
        elif len(args) == 2:
            path = args[0]
            name = args[1]
        else:
            raise qq.QQBadInvocation()

        tags = TagStorage()
        tags['tags'][name] = path
        qq.output('Tagged folder {} with name "{}".'.format(path, name))
        return True
Exemple #6
0
 def execute(self, command_name):
     try:
         inst = qq.instantiate_command(command_name)
     except Exception as e:
         qq.output('Failed to instantiate command: ' + command_name)
         qq.output(e)
     qq.output(inst.help())
     return True
Exemple #7
0
 def execute(self, command_name):
     try:
         inst = qq.instantiate_command(command_name)
     except Exception as e:
         qq.output('Failed to instantiate command: ' + command_name)
         qq.output(e)
         return False
     if inst is None:
         qq.output('Command not found: ' + command_name)
         return False
     editor = os.environ.get('EDITOR', None)
     if editor is None:
         qq.output('The EDITOR environment variable is not set.')
         return False
     qq.shell_execute('"{}" "{}"'.format(editor, inst.fullpath))
     return True