| 55 | | unpackOptions [] = [] |
| 56 | | unpackOptions (('-':[]):rest) = ["-"] ++ unpackOptions rest |
| 57 | | unpackOptions ("--":opts) = ["--"] ++ opts |
| 58 | | unpackOptions (('-':opt):rest) = unpackOption opt ++ unpackOptions rest |
| 59 | | unpackOptions (filename:rest) = filename : unpackOptions rest |
| | 54 | unpackOptions [] = [] |
| | 55 | unpackOptions (("-"):rest) = ("-":unpackOptions rest) |
| | 56 | unpackOptions opts@("--":_) = opts |
| | 57 | unpackOptions (('-':opt):arg:rest) |
| | 58 | | takesArg opt = unpackOption opt ++ (arg:unpackOptions rest) |
| | 59 | unpackOptions (('-':opt):rest) = unpackOption opt ++ unpackOptions rest |
| | 60 | unpackOptions opts@[filename] = opts |
| | 61 | unpackOptions (filename:rest) = filename : "--" : unpackOptions rest |
| | 62 | |
| | 63 | takesArg :: String -> Bool |
| | 64 | takesArg xs | xs `elem` withParam = True |
| | 65 | takesArg (x:xs) | x `elem` composable = takesArg xs |
| | 66 | takesArg _ = False |