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


Python utils.shell_quote函数代码示例

本文整理汇总了Python中youtube_dl.utils.shell_quote函数的典型用法代码示例。如果您正苦于以下问题:Python shell_quote函数的具体用法?Python shell_quote怎么用?Python shell_quote使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了shell_quote函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_completion

def build_completion(opt_parser):
    commands = []

    for group in opt_parser.option_groups:
        for option in group.option_list:
            long_option = option.get_opt_string().strip('-')
            help_msg = shell_quote([option.help])
            complete_cmd = ['complete', '--command', 'youtube-dl', '--long-option', long_option]
            if option._short_opts:
                complete_cmd += ['--short-option', option._short_opts[0].strip('-')]
            if option.help != optparse.SUPPRESS_HELP:
                complete_cmd += ['--description', option.help]
            complete_cmd.extend(EXTRA_ARGS.get(long_option, []))
            commands.append(shell_quote(complete_cmd))

    with open(FISH_COMPLETION_TEMPLATE) as f:
        template = f.read()
    filled_template = template.replace('{{commands}}', '\n'.join(commands))
    with open(FISH_COMPLETION_FILE, 'w') as f:
        f.write(filled_template)
开发者ID:ChidambaramR,项目名称:MyPythonScripts,代码行数:20,代码来源:fish-completion.py

示例2: test_shell_quote

 def test_shell_quote(self):
     args = ['ffmpeg', '-i', encodeFilename('ñ€ß\'.mp4')]
     self.assertEqual(shell_quote(args), """ffmpeg -i 'ñ€ß'"'"'.mp4'""")
开发者ID:Kyad,项目名称:youtube-dl,代码行数:3,代码来源:test_utils.py

示例3: test_shell_quote

 def test_shell_quote(self):
     args = ["ffmpeg", "-i", encodeFilename("ñ€ß'.mp4")]
     self.assertEqual(shell_quote(args), """ffmpeg -i 'ñ€ß'"'"'.mp4'""")
开发者ID:nyuszika7h,项目名称:youtube-dl,代码行数:3,代码来源:test_utils.py


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