diff options
Diffstat (limited to 'CmdLine/Usage.hs')
-rw-r--r-- | CmdLine/Usage.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/CmdLine/Usage.hs b/CmdLine/Usage.hs index b386be9a6..58408762b 100644 --- a/CmdLine/Usage.hs +++ b/CmdLine/Usage.hs @@ -1,6 +1,6 @@ {- git-annex usage messages - - - Copyright 2010-2011 Joey Hess <id@joeyh.name> + - Copyright 2010-2015 Joey Hess <id@joeyh.name> - - Licensed under the GNU GPL version 3 or higher. -} @@ -8,10 +8,10 @@ module CmdLine.Usage where import Common.Annex - import Types.Command import System.Console.GetOpt +import qualified Options.Applicative as O usageMessage :: String -> String usageMessage s = "Usage: " ++ s @@ -56,6 +56,13 @@ commandUsage cmd = unlines , "[option ...]" ] +{- Simple CommandParser generator, for when the CommandSeek wants all + - non-option parameters. -} +withParams :: (CmdParams -> CommandSeek) -> String -> CommandParser +withParams mkseek paramdesc = mkseek <$> O.many cmdparams + where + cmdparams = O.argument O.str (O.metavar paramdesc) + {- Descriptions of params used in usage messages. -} paramPaths :: String paramPaths = paramRepeating paramPath -- most often used |