Perl是否具有类似于docopt的模块? [英] Does Perl have a module similar to docopt?

查看:90
本文介绍了Perl是否具有类似于docopt的模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何与Docopt具有类似功能的Perl模块,或者正在为其开发端口?

Is there any Perl module that have similar functionality to Docopt or is there a port being developed for it?

Docopt是一个模块,用于通过解析用法和选项消息为命令行调用创建接口.

Docopt is a module that creates an interface for command line calls from parsing the usage and options messages.

您创建标准的帮助消息,例如

You create the standard help message like

    Naval Fate.

    Usage:
      naval_fate ship new ...
      naval_fate ship  move   [--speed=]
      naval_fate ship shoot  
      naval_fate mine (set|remove)   [--moored|--drifting]
      naval_fate -h | --help
      naval_fate --version

    Options:
      -h --help     Show this screen.
      --version     Show version.
      --speed=  Speed in knots [default: 10].
      --moored      Moored (anchored) mine.
      --drifting    Drifting mine.

然后为您创建选项处理程序,而不用Getopt :: Long再次编写它们,并且还处理命令解析(为此我使用App :: Cmd).

and then the options handler is created for you instead of writing them again with Getopt::Long and also handle the commands parsing (I use App::Cmd for that).

似乎它是从Python开始的,现在已经以许多其他语言实现.

Seems that it started in Python and now is implemented in many other languages.

http://docopt.org/

https://github.com/docopt/docopt

推荐答案

Perl指出了 Docopt 在@marderh的评论中.此外,还有其他提供类似功能的模块,例如 Getopt :: Auto Getopt :: Euclid

Perl has Docopt as pointed out in the comments by @marderh. In addition, there are other modules that provide similar functionality such as Getopt::Auto, Getopt::Euclid, Getopt::AsDocumented …

这篇关于Perl是否具有类似于docopt的模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆