def __init__(self): TextSource.__init__(self, name=_("Shell Commands")) # get bash aliases and functions bash_cmds = [ u'shopt -s expand_aliases', u'source /etc/bash.bashrc', u'source ' + quote(format(os.path.expanduser(u'~/.bashrc'))) ] self._bash_cmds = bash_cmds = u';'.join(bash_cmds) + ";" # get alias names try: lines = check_output( ('setsid', 'bash', '-i', '-c', bash_cmds + u'alias')) except OSError: # no bash pass else: # split into words self._aliases = aliases = [] for word in shlex.split(lines): # ignore empty and 'alias' word = word.strip() if word and '=' in word: # reduce to name aliases.append(word[:word.find('=')]) # get function names try: lines = check_output( ('setsid', 'bash', '-i', '-c', bash_cmds + u'declare -F')) except OSError: # no bash pass else: self._fns = fns = [] for line in lines.splitlines(): words = shlex.split(line.strip()) if words: # name is the last word in each line fn = words[-1] # probably don't want '_'-prefixed functions if not fn.startswith('_'): fns.append(fn)
def __init__(self): TextSource.__init__(self, name=_("Shell Commands")) # get bash aliases and functions bash_cmds = [u'shopt -s expand_aliases', u'source /etc/bash.bashrc', u'source ' + quote(format(os.path.expanduser(u'~/.bashrc')))] self._bash_cmds = bash_cmds = u';'.join(bash_cmds) + ";" # get alias names try: lines = check_output(('setsid', 'bash', '-i', '-c', bash_cmds + u'alias')) except OSError: # no bash pass else: # split into words self._aliases = aliases = [] for word in shlex.split(lines): # ignore empty and 'alias' word = word.strip() if word and '=' in word: # reduce to name aliases.append(word[:word.find('=')]) # get function names try: lines = check_output(('setsid', 'bash', '-i', '-c', bash_cmds + u'declare -F')) except OSError: # no bash pass else: self._fns = fns = [] for line in lines.splitlines(): words = shlex.split(line.strip()) if words: # name is the last word in each line fn = words[-1] # probably don't want '_'-prefixed functions if not fn.startswith('_'): fns.append(fn)
def __init__(self, sourcefile): self.sourcefile = sourcefile name = _("Rename To...").rstrip(".") TextSource.__init__(self, name)
def __init__(self): TextSource.__init__(self, _("Shell Story"))
def get_text_items(self, text): return TextSource.get_text_items(self, text.encode())
def __init__(self): TextSource.__init__(self, name=_('Tracker Full Text Search'))
def __init__(self, text): TextSource.__init__(self, _("search password")) self.text = text
def __init__(self): TextSource.__init__(self, name=_("Shell Commands"))
def __init__(self): TextSource.__init__(self, name=_("ID2 Identifiers"))
def __init__(self): TextSource.__init__(self, name="URL Text Matches")
def __init__(self): TextSource.__init__(self, name=u"Filesystem Text Matches")
def __init__(self, query): TextSource.__init__(self, name=_("Results for '%s'") % query) self.text = query
def __init__(self): TextSource.__init__(self, name=_("Text Matches"))
def __init__(self): TextSource.__init__(self, name=u"URL Text Matches")
def __init__(self): TextSource.__init__(self, name=_("Text"))
def __init__(self, name, extension, sourcefile=None): TextSource.__init__(self, name) self.sourcefile = sourcefile self.extension = extension
def object_source(self, for_item=None): return TextSource()
def __init__(self): TextSource.__init__(self, name="Filesystem Text Matches")
def object_source(self, for_item): return TextSource(placeholder=_("Search Terms"))