I would like to create a program who get some arguments with cmdargs. I would like to retrieve a list of filepath and list of actions to do. I needs these files to be taken and these actions to be perfomed in order.
My arguments are declared like this :
data Options =
Mode1 {
input :: [FilePath]
, act1 :: Bool
, act2 :: Bool
, act3 :: Bool
} deriving (Data, Typeable, Show, Eq)
mode1 =
Mode1 {
input = [] &= name "i" &= help "input file" &= typ "FILE"
, act1 = False &= name "a" &= help "action 1" &= typ "ACTION"
, act2 = False &= name "b" &= help "action 2" &= typ "ACTION"
, act3 = False &= name "c" &= help "action 3" &= typ "ACTION"
}
I managed to get the list of filepath in order with a list of String
(FilePath
). In this way I can get my input files ordered with :
./myprog --input="file1.txt" --input="file2.txt"
./myprog --input="file2.txt" --input="file1.txt"
But I can't have my actions to be ordered as far as they are declared as Bool
.
I would like to pass my arguments like this :
./myprog --act1 --act2 --act3 --input="file1.txt" --input="file2.txt"
./myprog --act3 --act1 --input="file1.txt" --input="file2.txt"
./myprog --act2 --act3 --act1 --input="file1.txt" --input="file2.txt"
to get differents output results.
Is it possible with cmdargs to retrieve differents arguments in order ?