本文整理汇总了Python中ranger.ext.get_executables.get_executables方法的典型用法代码示例。如果您正苦于以下问题:Python get_executables.get_executables方法的具体用法?Python get_executables.get_executables怎么用?Python get_executables.get_executables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ranger.ext.get_executables
的用法示例。
在下文中一共展示了get_executables.get_executables方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tab
# 需要导入模块: from ranger.ext import get_executables [as 别名]
# 或者: from ranger.ext.get_executables import get_executables [as 别名]
def tab(self, tabnum):
from ranger.ext.get_executables import get_executables
if self.arg(1) and self.arg(1)[0] == '-':
command = self.rest(2)
else:
command = self.rest(1)
start = self.line[0:len(self.line) - len(command)]
try:
position_of_last_space = command.rindex(" ")
except ValueError:
return (start + program + ' ' for program
in get_executables() if program.startswith(command))
if position_of_last_space == len(command) - 1:
selection = self.fm.thistab.get_selection()
if len(selection) == 1:
return self.line + selection[0].shell_escaped_basename + ' '
else:
return self.line + '%s '
else:
before_word, start_of_word = self.line.rsplit(' ', 1)
return (before_word + ' ' + file.shell_escaped_basename
for file in self.fm.thisdir.files or []
if file.shell_escaped_basename.startswith(start_of_word))
示例2: tab
# 需要导入模块: from ranger.ext import get_executables [as 别名]
# 或者: from ranger.ext.get_executables import get_executables [as 别名]
def tab(self, tabnum):
from ranger.ext.get_executables import get_executables
if self.arg(1) and self.arg(1)[0] == '-':
command = self.rest(2)
else:
command = self.rest(1)
start = self.line[0:len(self.line) - len(command)]
try:
position_of_last_space = command.rindex(" ")
except ValueError:
return (start + program + ' ' for program \
in get_executables() if program.startswith(command))
if position_of_last_space == len(command) - 1:
selection = self.fm.thistab.get_selection()
if len(selection) == 1:
return self.line + selection[0].shell_escaped_basename + ' '
else:
return self.line + '%s '
else:
before_word, start_of_word = self.line.rsplit(' ', 1)
return (before_word + ' ' + file.shell_escaped_basename \
for file in self.fm.thisdir.files or [] \
if file.shell_escaped_basename.startswith(start_of_word))
示例3: tab
# 需要导入模块: from ranger.ext import get_executables [as 别名]
# 或者: from ranger.ext.get_executables import get_executables [as 别名]
def tab(self):
from ranger.ext.get_executables import get_executables
if self.arg(1) and self.arg(1)[0] == '-':
command = self.rest(2)
else:
command = self.rest(1)
start = self.line[0:len(self.line) - len(command)]
try:
position_of_last_space = command.rindex(" ")
except ValueError:
return (start + program + ' ' for program \
in get_executables() if program.startswith(command))
if position_of_last_space == len(command) - 1:
selection = self.fm.thistab.get_selection()
if len(selection) == 1:
return self.line + selection[0].shell_escaped_basename + ' '
else:
return self.line + '%s '
else:
before_word, start_of_word = self.line.rsplit(' ', 1)
return (before_word + ' ' + file.shell_escaped_basename \
for file in self.fm.thisdir.files \
if file.shell_escaped_basename.startswith(start_of_word))
示例4: execute
# 需要导入模块: from ranger.ext import get_executables [as 别名]
# 或者: from ranger.ext.get_executables import get_executables [as 别名]
def execute(self):
from ranger.ext.get_executables import get_term
self.fm.run(get_term(), flags='f')
示例5: execute
# 需要导入模块: from ranger.ext import get_executables [as 别名]
# 或者: from ranger.ext.get_executables import get_executables [as 别名]
def execute(self):
import os
from ranger.ext.get_executables import get_executables
command = os.environ.get('TERMCMD', os.environ.get('TERM'))
if command not in get_executables():
command = 'x-terminal-emulator'
if command not in get_executables():
command = 'xterm'
self.fm.run(command, flags='f')