Haskell的
cmdArgs package提供了命令选项解析.
@H_403_20@基于来自文档http://hackage.haskell.org/packages/archive/cmdargs/0.10.3/doc/html/System-Console-CmdArgs-Explicit.html#g:4及其来源http://hackage.haskell.org/packages/archive/cmdargs/0.10.3/doc/html/src/System-Console-CmdArgs-Explicit-Complete.html#Complete的此页面
它似乎能够支持bash完成,但我无法使用解析器的隐式版本. http://hackage.haskell.org/packages/archive/cmdargs/0.10.3/doc/html/System-Console-CmdArgs-Implicit.html
有没有人有这样做的例子?
编辑添加了更好的示例
如果我有这个程序
{-# LANGUAGE DeriveDataTypeable #-} import System.Console.CmdArgs data Sample = Sample {hello :: String} deriving (Show,Data,Typeable) sample = Sample{hello = def} main = print =<< cmdArgs sample
与解析以下选项
The sample program sample [OPTIONS] Common flags: -h --hello=ITEM -? --help Display help message -V --version Print version information
如何使用cmdArgs的bash完成功能?