You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems both --flag=value and --flag value style works for all argument types except booleans. Here is a small example to reproduce.
It could probably be made smaller by relying on implicits, but I am afraid of leaving things implicit, so everything is explicit. :)
{-# LANGUAGE DeriveDataTypeable #-}
module Test where
import Data.Data ( Data, Typeable )
import System.Console.CmdArgs
data Test
= Foo
{ flagS :: String
, flagI :: Int
, flagB :: Bool
}
deriving (Eq, Ord, Show, Data, Typeable)
ui :: Test
ui = modes
[ Foo
{ flagS
= "abc"
&= typ "STR"
&= name "flag-s"
&= name "s"
&= explicit
&= help "flag s"
, flagI
= 0
&= typ "INT"
&= name "flag-i"
&= name "i"
&= explicit
&= help "flag i"
, flagB
= True
&= typ "BOOL"
&= name "flag-b"
&= name "b"
&= explicit
&= help "flag b"
} &= name "foo"
&= explicit
&= help "do some foo"
] &= program "test"
&= helpArg [explicit, name "help"]
&= versionArg [explicit, name "version"]
&= summary "This is a test program"
&= help "This is a test program"
main :: IO ()
main = do
cli <- cmdArgs ui
print cli
It seems both
--flag=value
and--flag value
style works for all argument types except booleans. Here is a small example to reproduce.It could probably be made smaller by relying on implicits, but I am afraid of leaving things implicit, so everything is explicit. :)
test.sh
The text was updated successfully, but these errors were encountered: