示例#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
文件: tracker1.py 项目: engla/kupfer
 def __init__(self):
     TextSource.__init__(self, name=_('Tracker Full Text Search'))
示例#7
0
文件: tracker1.py 项目: guns/kupfer
 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
文件: __init__.py 项目: emareg/kupfer
 def __init__(self):
     TextSource.__init__(self, name=_("ID2 Identifiers"))
示例#11
0
文件: text.py 项目: emareg/kupfer
 def __init__(self):
     TextSource.__init__(self, name="URL Text Matches")
示例#12
0
文件: text.py 项目: tuxcanfly/kupfer
	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
文件: text.py 项目: tuxcanfly/kupfer
	def __init__(self):
		TextSource.__init__(self, name=_("Text Matches"))
示例#15
0
文件: text.py 项目: tuxcanfly/kupfer
	def __init__(self):
		TextSource.__init__(self, name=u"URL Text Matches")
示例#16
0
文件: text.py 项目: scoward/kupfer
	def __init__(self):
		TextSource.__init__(self, name=_("Text"))
示例#17
0
 def __init__(self):
     TextSource.__init__(self, _("Shell Story"))
示例#18
0
文件: text.py 项目: emareg/kupfer
 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
文件: zim.py 项目: somas95/kupfer
 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
文件: text.py 项目: emareg/kupfer
 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"))