better error message
This commit is contained in:
parent
80a0be5116
commit
5c5ff2cb78
1 changed files with 9 additions and 6 deletions
|
@ -40,14 +40,17 @@ cmds = map adddirparam $ cmds_readonly ++ cmds_notreadonly
|
|||
|
||||
options :: [OptDescr (Annex ())]
|
||||
options = commonOptions ++
|
||||
[ Option [] ["uuid"] (ReqArg check paramUUID) "repository uuid"
|
||||
[ Option [] ["uuid"] (ReqArg checkuuid paramUUID) "repository uuid"
|
||||
]
|
||||
where
|
||||
check expected = do
|
||||
u <- getUUID
|
||||
when (u /= toUUID expected) $ error $
|
||||
"expected repository UUID " ++ expected
|
||||
++ " but found UUID " ++ fromUUID u
|
||||
checkuuid expected = getUUID >>= check
|
||||
where
|
||||
check u | u == toUUID expected = return ()
|
||||
check NoUUID = unexpected "uninitialized repository"
|
||||
check u = unexpected $ "UUID " ++ fromUUID u
|
||||
unexpected s = error $
|
||||
"expected repository UUID " ++
|
||||
expected ++ " but found " ++ s
|
||||
|
||||
header :: String
|
||||
header = "Usage: git-annex-shell [-c] command [parameters ...] [option ..]"
|
||||
|
|
Loading…
Reference in a new issue