Haskell的cmdArgs 包提供命令选项解析。
基于文档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/System-Console-CmdArgs-Explicit.html#g:4 /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
with 解析以下选项
The sample program
sample [OPTIONS]
Common flags:
-h --hello=ITEM
-? --help Display help message
-V --version Print version information
如何使用 cmdArgs 的 bash 补全功能?