0

I've recently started using thor. I've set my script up with some global options, such as -l --logging and -v --verbose. I'd like users to be able to call my thor task with "-lv" rather than "-l -v", but this doesn't seem possible. Has anyone encountered this problem, discussion of this problem, or a solution to this problem? (I haven't...)

Thanks!

PS for bonus marks, are these argument clusters called something? Is "unix-like options" meaningful, or is there some name for that?

4

1 回答 1

1

标准库中有几个项目,应该可以帮助您支持 Unixy 标志/命令行参数:

getoptlong让人想起 Perl 的 GetOpt 库,因此如果您使用过它(或其他语言的众多克隆之一),这对您来说可能很容易。

否则,optparse更像 Ruby,因此使用起来可能更自然。

于 2011-06-22T20:30:35.937 回答