Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
	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)
Exemplo n.º 3
0
 def __init__(self, sourcefile):
     self.sourcefile = sourcefile
     name = _("Rename To...").rstrip(".")
     TextSource.__init__(self, name)
Exemplo n.º 4
0
 def __init__(self):
     TextSource.__init__(self, _("Shell Story"))
Exemplo n.º 5
0
 def get_text_items(self, text):
     return TextSource.get_text_items(self, text.encode())
Exemplo n.º 6
0
 def __init__(self):
     TextSource.__init__(self, name=_('Tracker Full Text Search'))
Exemplo n.º 7
0
 def __init__(self):
     TextSource.__init__(self, name=_('Tracker Full Text Search'))
Exemplo n.º 8
0
 def __init__(self, text):
     TextSource.__init__(self, _("search password"))
     self.text = text
Exemplo n.º 9
0
	def __init__(self):
		TextSource.__init__(self, name=_("Shell Commands"))
Exemplo n.º 10
0
 def __init__(self):
     TextSource.__init__(self, name=_("ID2 Identifiers"))
Exemplo n.º 11
0
 def __init__(self):
     TextSource.__init__(self, name="URL Text Matches")
Exemplo n.º 12
0
	def __init__(self):
		TextSource.__init__(self, name=u"Filesystem Text Matches")
Exemplo n.º 13
0
 def __init__(self, query):
     TextSource.__init__(self, name=_("Results for '%s'") % query)
     self.text = query
Exemplo n.º 14
0
	def __init__(self):
		TextSource.__init__(self, name=_("Text Matches"))
Exemplo n.º 15
0
	def __init__(self):
		TextSource.__init__(self, name=u"URL Text Matches")
Exemplo n.º 16
0
	def __init__(self):
		TextSource.__init__(self, name=_("Text"))
Exemplo n.º 17
0
 def __init__(self):
     TextSource.__init__(self, _("Shell Story"))
Exemplo n.º 18
0
 def __init__(self):
     TextSource.__init__(self, name=_("Text"))
Exemplo n.º 19
0
 def get_text_items(self, text):
     return TextSource.get_text_items(self, text.encode())
Exemplo n.º 20
0
	def __init__(self, name, extension, sourcefile=None):
		TextSource.__init__(self, name)
		self.sourcefile = sourcefile
		self.extension = extension
Exemplo n.º 21
0
 def object_source(self, for_item=None):
     return TextSource()
Exemplo n.º 22
0
 def __init__(self, name, extension, sourcefile=None):
     TextSource.__init__(self, name)
     self.sourcefile = sourcefile
     self.extension = extension
Exemplo n.º 23
0
 def __init__(self):
     TextSource.__init__(self, name="Filesystem Text Matches")
Exemplo n.º 24
0
 def __init__(self, sourcefile):
     self.sourcefile = sourcefile
     name = _("Rename To...").rstrip(".")
     TextSource.__init__(self, name)
Exemplo n.º 25
0
 def object_source(self, for_item):
     return TextSource(placeholder=_("Search Terms"))
Exemplo n.º 26
0
	def __init__(self):
		TextSource.__init__(self, name=_("Shell Commands"))