From 5c5ff2cb78230ca6311d49dc2573579af49d8c37 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Nov 2011 19:17:07 -0400 Subject: better error message --- git-annex-shell.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'git-annex-shell.hs') diff --git a/git-annex-shell.hs b/git-annex-shell.hs index 57f6b2916..658eddd77 100644 --- a/git-annex-shell.hs +++ b/git-annex-shell.hs @@ -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 ..]" -- cgit v1.2.3