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