This commit is contained in:
Joey Hess 2014-12-29 15:35:14 -04:00
parent 43dc7f678f
commit 56540f95d1

View file

@ -9,13 +9,12 @@ module Command.SetPresentKey where
import Common.Annex import Common.Annex
import Command import Command
import qualified Annex
import Logs.Location import Logs.Location
import Logs.Presence.Pure import Logs.Presence.Pure
import Types.Key import Types.Key
cmd :: [Command] cmd :: [Command]
cmd = [noCommit $ command "setpresentkey" (paramPair paramKey "[1|0]") seek cmd = [noCommit $ command "setpresentkey" (paramPair paramKey (paramPair paramUUID "[1|0]")) seek
SectionPlumbing "change records of where key is present"] SectionPlumbing "change records of where key is present"]
seek :: CommandSeek seek :: CommandSeek
@ -24,13 +23,13 @@ seek = withWords start
start :: [String] -> CommandStart start :: [String] -> CommandStart
start (ks:us:vs:[]) = do start (ks:us:vs:[]) = do
showStart' "setpresentkey" k Nothing showStart' "setpresentkey" k Nothing
next $ perform k (toUUID us) status next $ perform k (toUUID us) s
where where
k = fromMaybe (error "bad key") (file2key ks) k = fromMaybe (error "bad key") (file2key ks)
status = fromMaybe (error "bad value") (parseStatus vs) s = fromMaybe (error "bad value") (parseStatus vs)
start _ = error "Wrong number of parameters" start _ = error "Wrong number of parameters"
perform :: Key -> UUID -> LogStatus -> CommandPerform perform :: Key -> UUID -> LogStatus -> CommandPerform
perform k u status = next $ do perform k u s = next $ do
logChange k u status logChange k u s
return True return True