当前位置: 首页>>代码示例>>Python>>正文


Python get_executables.get_executables方法代码示例

本文整理汇总了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)) 
开发者ID:GuidoFe,项目名称:myDotFiles,代码行数:26,代码来源:commands_full.py

示例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)) 
开发者ID:maotora,项目名称:dotfiles,代码行数:26,代码来源:commands_full.py

示例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)) 
开发者ID:quanttyo,项目名称:dotfiles,代码行数:26,代码来源:commands_full.py

示例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') 
开发者ID:GuidoFe,项目名称:myDotFiles,代码行数:5,代码来源:commands_full.py

示例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') 
开发者ID:maotora,项目名称:dotfiles,代码行数:11,代码来源:commands_full.py


注:本文中的ranger.ext.get_executables.get_executables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。