A very simplistic CLI args parser. If you're looking for a proper / full-fledged one, check out elm-cli-options-parser.
getStringValue : String -> String -> Maybe String
Get the value of a CLI option/argument which you expect to be a string:
getStringValue "file" "--file ./file_path.js" == Just "./file_path.js"
getStringValue "output" "--file ./file_path.js" == Nothing
getBooleanValue : String -> String -> Maybe Basics.Bool
Get the value of a CLI option/argument which you expect to be just a flag without any value associated with it:
getBooleanValue "debug" "--debug" == Just True
getBooleanValue "debug" "--debug=true" == Nothing
getBooleanValue "debug" "--enabled" == Nothing
getIntValue : String -> String -> Maybe Basics.Int
Get the value of a CLI option/argument which you expect to be an integer:
getIntValue "count" "--count=5" == Just 5
getIntValue "count" "--count 5" == Just 5
getIntValue "count" "--file ./file_path.js" == Nothing
getFloatValue : String -> String -> Maybe Basics.Float
Get the value of a CLI option/argument which you expect to be an integer:
getFloatValue "factor" "--factor=5.5" == Just 5.5
getFloatValue "factor" "--factor 5.5" == Just 5.5
getFloatValue "factor" "--file ./file_path.js" == Nothing