summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CmdLine/Usage.hs4
-rw-r--r--Command.hs12
-rw-r--r--Command/Help.hs2
-rw-r--r--Command/Info.hs2
-rw-r--r--Command/ReKey.hs2
-rw-r--r--Command/Sync.hs2
-rw-r--r--Command/VPop.hs2
7 files changed, 15 insertions, 11 deletions
diff --git a/CmdLine/Usage.hs b/CmdLine/Usage.hs
index ad1d4e583..b386be9a6 100644
--- a/CmdLine/Usage.hs
+++ b/CmdLine/Usage.hs
@@ -58,7 +58,7 @@ commandUsage cmd = unlines
{- Descriptions of params used in usage messages. -}
paramPaths :: String
-paramPaths = paramOptional $ paramRepeating paramPath -- most often used
+paramPaths = paramRepeating paramPath -- most often used
paramPath :: String
paramPath = "PATH"
paramKey :: String
@@ -114,6 +114,6 @@ paramNothing = ""
paramRepeating :: String -> String
paramRepeating s = s ++ " ..."
paramOptional :: String -> String
-paramOptional s = "[" ++ s ++ "]"
+paramOptional s = s
paramPair :: String -> String -> String
paramPair a b = a ++ " " ++ b
diff --git a/Command.hs b/Command.hs
index 6522924c3..4fc665ba2 100644
--- a/Command.hs
+++ b/Command.hs
@@ -36,13 +36,17 @@ import CmdLine.GitAnnex.Options as ReExported
import qualified Options.Applicative as O
{- Generates a normal Command -}
-command :: String -> String -> CommandSection -> String -> CommandParser -> Command
-command = Command [] Nothing commonChecks False False
+command :: String -> String -> CommandSection -> String -> (Command -> CommandParser) -> Command
+command name paramdesc section desc parser = c
+ where
+ c = Command [] Nothing commonChecks False False name paramdesc section desc (parser c)
{- Simple CommandParser generator, for when the CommandSeek wants all
- non-option parameters. -}
-commandParser :: (CmdParams -> CommandSeek) -> CommandParser
-commandParser mkseek = mkseek <$> O.many (O.argument O.str O.idm)
+commandParser :: (CmdParams -> CommandSeek) -> Command -> CommandParser
+commandParser mkseek c = mkseek <$> O.many cmdparams
+ where
+ cmdparams = O.argument O.str (O.metavar (cmdparamdesc c))
{- Indicates that a command doesn't need to commit any changes to
- the git-annex branch. -}
diff --git a/Command/Help.hs b/Command/Help.hs
index 073ab2b36..b6b1be379 100644
--- a/Command/Help.hs
+++ b/Command/Help.hs
@@ -23,7 +23,7 @@ import System.Console.GetOpt
cmd :: Command
cmd = noCommit $ noRepo startNoRepo $ dontCheck repoExists $
- command "help" (paramOptional "COMMAND") seek SectionCommon "display help"
+ command "help" "COMMAND" seek SectionCommon "display help"
seek :: CommandSeek
seek = withWords start
diff --git a/Command/Info.hs b/Command/Info.hs
index 802aabb56..0c8200ff3 100644
--- a/Command/Info.hs
+++ b/Command/Info.hs
@@ -80,7 +80,7 @@ type StatState = StateT StatInfo Annex
cmd :: Command
cmd = noCommit $ dontCheck repoExists $ withOptions (jsonOption : bytesOption : annexedMatchingOptions) $
- command "info" (paramOptional $ paramRepeating paramItem) seek SectionQuery
+ command "info" (paramRepeating paramItem) seek SectionQuery
"shows information about the specified item or the repository as a whole"
seek :: CommandSeek
diff --git a/Command/ReKey.hs b/Command/ReKey.hs
index 319f3eda8..2a2787898 100644
--- a/Command/ReKey.hs
+++ b/Command/ReKey.hs
@@ -20,7 +20,7 @@ import qualified Remote
cmd :: Command
cmd = notDirect $ command "rekey"
- (paramOptional $ paramRepeating $ paramPair paramPath paramKey)
+ (paramRepeating $ paramPair paramPath paramKey)
seek SectionPlumbing "change keys used for files"
seek :: CommandSeek
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 10b9fc2cd..95bd7c8d7 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -53,7 +53,7 @@ import qualified Data.Map as M
cmd :: Command
cmd = withOptions syncOptions $
- command "sync" (paramOptional (paramRepeating paramRemote))
+ command "sync" (paramRepeating paramRemote)
seek SectionCommon "synchronize local repository with remotes"
syncOptions :: [Option]
diff --git a/Command/VPop.hs b/Command/VPop.hs
index f6fc56b08..0dadd52fb 100644
--- a/Command/VPop.hs
+++ b/Command/VPop.hs
@@ -18,7 +18,7 @@ import Command.View (checkoutViewBranch)
cmd :: Command
cmd = notBareRepo $ notDirect $
- command "vpop" (paramOptional paramNumber) seek SectionMetaData
+ command "vpop" paramNumber seek SectionMetaData
"switch back to previous view"
seek :: CommandSeek