clean up params in usage display

This commit is contained in:
Joey Hess 2011-09-15 14:33:37 -04:00
parent 984c9fc052
commit 9fe3c6d211
16 changed files with 25 additions and 24 deletions

View file

@ -212,12 +212,8 @@ notSymlink :: FilePath -> IO Bool
notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f
{- Descriptions of params used in usage messages. -}
paramRepeating :: String -> String
paramRepeating s = s ++ " ..."
paramOptional :: String -> String
paramOptional s = "[" ++ s ++ "]"
paramPair :: String -> String -> String
paramPair a b = a ++ " " ++ b
paramPaths :: String
paramPaths = paramOptional $ paramRepeating paramPath -- most often used
paramPath :: String
paramPath = "PATH"
paramKey :: String
@ -240,6 +236,12 @@ paramKeyValue :: String
paramKeyValue = "K=V"
paramNothing :: String
paramNothing = ""
paramRepeating :: String -> String
paramRepeating s = s ++ " ..."
paramOptional :: String -> String
paramOptional s = "[" ++ s ++ "]"
paramPair :: String -> String -> String
paramPair a b = a ++ " " ++ b
{- The Key specified by the --key parameter. -}
cmdlineKey :: Annex Key

View file

@ -29,7 +29,7 @@ import Utility.SafeCommand
import Locations
command :: [Command]
command = [repoCommand "add" paramPath seek "add files to annex"]
command = [repoCommand "add" paramPaths seek "add files to annex"]
{- Add acts on both files not checked into git yet, and unlocked files. -}
seek :: [CommandSeek]

View file

@ -11,7 +11,7 @@ import Command
import qualified Command.Move
command :: [Command]
command = [repoCommand "copy" paramPath seek
command = [repoCommand "copy" paramPaths seek
"copy content of files to/from another repository"]
-- A copy is just a move that does not delete the source file.

View file

@ -20,7 +20,7 @@ import Trust
import Config
command :: [Command]
command = [repoCommand "drop" paramPath seek
command = [repoCommand "drop" paramPaths seek
"indicate content of files not currently wanted"]
seek :: [CommandSeek]

View file

@ -14,8 +14,7 @@ import Content
import Utility.Conditional
command :: [Command]
command = [repoCommand "find" (paramOptional $ paramRepeating paramPath) seek
"lists available files"]
command = [repoCommand "find" paramPaths seek "lists available files"]
seek :: [CommandSeek]
seek = [withFilesInGit start]

View file

@ -19,7 +19,7 @@ import Content
import Messages
command :: [Command]
command = [repoCommand "fix" paramPath seek
command = [repoCommand "fix" paramPaths seek
"fix up symlinks to point to annexed content"]
seek :: [CommandSeek]

View file

@ -30,8 +30,7 @@ import Utility.Path
import Config
command :: [Command]
command = [repoCommand "fsck" (paramOptional $ paramRepeating paramPath) seek
"check for problems"]
command = [repoCommand "fsck" paramPaths seek "check for problems"]
seek :: [CommandSeek]
seek = [withNumCopies start]

View file

@ -17,7 +17,7 @@ import Utility
import qualified Command.Move
command :: [Command]
command = [repoCommand "get" paramPath seek
command = [repoCommand "get" paramPaths seek
"make content of annexed files available"]
seek :: [CommandSeek]

View file

@ -16,7 +16,7 @@ import qualified AnnexQueue
import Utility.SafeCommand
command :: [Command]
command = [repoCommand "lock" paramPath seek "undo unlock command"]
command = [repoCommand "lock" paramPaths seek "undo unlock command"]
seek :: [CommandSeek]
seek = [withFilesUnlocked start, withFilesUnlockedToBeCommitted start]

View file

@ -25,7 +25,8 @@ import Utility.Conditional
import qualified Command.Add
command :: [Command]
command = [repoCommand "migrate" paramPath seek "switch data to different backend"]
command = [repoCommand "migrate" paramPaths seek
"switch data to different backend"]
seek :: [CommandSeek]
seek = [withBackendFilesInGit start]

View file

@ -20,7 +20,7 @@ import UUID
import Messages
command :: [Command]
command = [repoCommand "move" paramPath seek
command = [repoCommand "move" paramPaths seek
"move content of files to/from another repository"]
seek :: [CommandSeek]

View file

@ -12,7 +12,7 @@ import qualified Command.Add
import qualified Command.Fix
command :: [Command]
command = [repoCommand "pre-commit" paramPath seek "run by git pre-commit hook"]
command = [repoCommand "pre-commit" paramPaths seek "run by git pre-commit hook"]
{- The pre-commit hook needs to fix symlinks to all files being committed.
- And, it needs to inject unlocked files into the annex. -}

View file

@ -27,7 +27,7 @@ import Messages
import Locations
command :: [Command]
command = [repoCommand "unannex" paramPath seek "undo accidential add command"]
command = [repoCommand "unannex" paramPaths seek "undo accidential add command"]
seek :: [CommandSeek]
seek = [withFilesInGit start]

View file

@ -22,7 +22,7 @@ import Content
import Locations
command :: [Command]
command = [repoCommand "uninit" paramPath seek
command = [repoCommand "uninit" paramPaths seek
"de-initialize git-annex and clean out repository"]
seek :: [CommandSeek]

View file

@ -22,8 +22,8 @@ import Utility.Path
command :: [Command]
command =
[ repoCommand "unlock" paramPath seek "unlock files for modification"
, repoCommand "edit" paramPath seek "same as unlock"
[ repoCommand "unlock" paramPaths seek "unlock files for modification"
, repoCommand "edit" paramPaths seek "same as unlock"
]
seek :: [CommandSeek]

View file

@ -17,7 +17,7 @@ import Types
import Trust
command :: [Command]
command = [repoCommand "whereis" (paramOptional $ paramRepeating paramPath) seek
command = [repoCommand "whereis" paramPaths seek
"lists repositories that have file content"]
seek :: [CommandSeek]