我一直从运行线运行程序,这些程序使您可以混合运行线参数的顺序。如果您在混合中添加其他内容,它们会抓住您。例如:
$ xxx -r abc -q def -w xyz
$ xxx -w xyz -q def -r abc
他们如何做到的?为此有一些模块吗?
非常感谢,
-T
这里是使用Getopt::Long的示例:
use v6;
use Getopt::Long;
my %opt = help => 0, 'r=s' => "", 'q=s' => "", "w=s" => "";
my %options = get-options(%opt).hash;
say %options;
示例运行:
$ p.p6 -w xyz -q def -r abc
{help => 0, q => def, r => abc, w => xyz}