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 :: [OptDescr (Annex ())]
|
||||||
options = commonOptions ++
|
options = commonOptions ++
|
||||||
[ Option [] ["uuid"] (ReqArg check paramUUID) "repository uuid"
|
[ Option [] ["uuid"] (ReqArg checkuuid paramUUID) "repository uuid"
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
check expected = do
|
checkuuid expected = getUUID >>= check
|
||||||
u <- getUUID
|
where
|
||||||
when (u /= toUUID expected) $ error $
|
check u | u == toUUID expected = return ()
|
||||||
"expected repository UUID " ++ expected
|
check NoUUID = unexpected "uninitialized repository"
|
||||||
++ " but found UUID " ++ fromUUID u
|
check u = unexpected $ "UUID " ++ fromUUID u
|
||||||
|
unexpected s = error $
|
||||||
|
"expected repository UUID " ++
|
||||||
|
expected ++ " but found " ++ s
|
||||||
|
|
||||||
header :: String
|
header :: String
|
||||||
header = "Usage: git-annex-shell [-c] command [parameters ...] [option ..]"
|
header = "Usage: git-annex-shell [-c] command [parameters ...] [option ..]"
|
||||||
|
|
Loading…
Reference in a new issue