X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FCommandLine.hs;h=68957b1c4d2e4cf9fb19d10762fdfc870348417c;hb=79e77832f17cca783e03498b581f8acb59c9d035;hp=51f20289fe9adb1c3c28163f92b308389a0eba3d;hpb=3296c2f6578001f6a40de1b1e1f79b25c987d3af;p=hath.git diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 51f2028..68957b1 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -21,11 +21,12 @@ lowercase :: String -> String lowercase = map toLower --- The application currently has two modes. The default, Regex, will +-- The application currently has four modes. The default, Regex, will -- compute a regular expression matching the input CIDRs. Reduce, on -- the other hand, will combine any redundant/adjacent CIDR blocks --- into one. -data Mode = Regex | Reduce +-- into one. Dupe will show you what would be removed by Reduce, and +-- Diff will show both additions and deletions in a diff-like format. +data Mode = Regex | Reduce | Dupe | Diff -- A record containing values for all available options. @@ -71,7 +72,7 @@ set_input arg opts = do -- The usage header usage :: String -usage = "Usage: hath [-h] [-i FILE]" +usage = "Usage: hath [regexed|reduced|duped|diffed] [-h] [-i FILE]" -- The usage header, and all available flags (as generated by GetOpt) @@ -106,9 +107,15 @@ parse_mode = do else do -- Some non-option was given, but were any of them modes? case (lowercase (non_options !! 0)) of - "regex" -> return Regex - "reduce" -> return Reduce - _ -> return Regex + "regex" -> return Regex + "regexed" -> return Regex + "reduce" -> return Reduce + "reduced" -> return Reduce + "dupe" -> return Dupe + "duped" -> return Dupe + "diff" -> return Diff + "diffed" -> return Diff + _ -> return Regex