X-Git-Url: http://gitweb.michael.orlitzky.com/?p=hath.git;a=blobdiff_plain;f=src%2FCommandLine.hs;h=8e6b49cfdef35fd22ce6dcd9badfcec9fc4fffba;hp=9d409ac89c6fb07852d06a8e002a80796458ce4f;hb=2404313e648301064041c12fdab8d2f976c26a64;hpb=097949fec1de71ad9f7d94dc16980c8ca4a18640 diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 9d409ac..8e6b49c 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -51,10 +51,15 @@ barriers_help = normalize_help :: String normalize_help = - "(reduced mode) normalize the output CIDRS, replacing any " ++ + "(reduced mode) normalize the output CIDRs, replacing any " ++ "masked bits by zeros; e.g. '127.0.0.1/8' -> '127.0.0.0/8'" +sort_help :: String +sort_help = + "(reduced mode) sort the output CIDRs by their octets" + + -- | The Args type represents the possible command-line options. The -- duplication here seems necessary; CmdArgs' magic requires us to -- define some things explicitly. @@ -64,11 +69,11 @@ normalize_help = -- same options and arguments. -- data Args = - Regexed { barriers :: Bool, normalize :: Bool } | - Reduced { barriers :: Bool, normalize :: Bool } | - Duped { barriers :: Bool, normalize :: Bool } | - Diffed { barriers :: Bool, normalize :: Bool } | - Listed { barriers :: Bool, normalize :: Bool } + Regexed { barriers :: Bool, normalize :: Bool, sort :: Bool } | + Reduced { barriers :: Bool, normalize :: Bool, sort :: Bool } | + Duped { barriers :: Bool, normalize :: Bool, sort :: Bool } | + Diffed { barriers :: Bool, normalize :: Bool, sort :: Bool } | + Listed { barriers :: Bool, normalize :: Bool, sort :: Bool } deriving (Data, Show) -- | Description of the 'Regexed' mode. @@ -113,15 +118,18 @@ arg_spec = name "v", groupname "Common flags"] where - make_mode :: (Bool -> Bool -> Args) -> String -> (Annotate Ann) + make_mode :: (Bool -> Bool -> Bool -> Args) -> String -> (Annotate Ann) make_mode ctor desc = - record (ctor def def) + record (ctor def def def) [ barriers := def += groupname "Common flags" += help barriers_help, normalize := def += groupname "Common flags" - += help normalize_help ] + += help normalize_help, + sort := def + += groupname "Common flags" + += help sort_help ] += details [" " ++ desc] regexed = make_mode Regexed regexed_description