summaryrefslogtreecommitdiff
path: root/Command/GroupWanted.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/GroupWanted.hs')
-rw-r--r--Command/GroupWanted.hs24
1 files changed, 3 insertions, 21 deletions
diff --git a/Command/GroupWanted.hs b/Command/GroupWanted.hs
index 859a39c1b..5cdf785d7 100644
--- a/Command/GroupWanted.hs
+++ b/Command/GroupWanted.hs
@@ -8,13 +8,9 @@
module Command.GroupWanted where
import Common.Annex
-import qualified Annex
import Command
import Logs.PreferredContent
-import Types.Messages
-import Types.Group
-
-import qualified Data.Map as M
+import Command.Wanted (performGet, performSet)
cmd :: [Command]
cmd = [command "groupwanted" (paramPair paramGroup (paramOptional paramExpression)) seek
@@ -24,22 +20,8 @@ seek :: CommandSeek
seek = withWords start
start :: [String] -> CommandStart
-start (g:[]) = next $ performGet g
+start (g:[]) = next $ performGet groupPreferredContentMapRaw g
start (g:expr:[]) = do
showStart "groupwanted" g
- next $ performSet g expr
+ next $ performSet groupPreferredContentSet expr g
start _ = error "Specify a group."
-
-performGet :: Group -> CommandPerform
-performGet g = do
- Annex.setOutput QuietOutput
- m <- groupPreferredContentMapRaw
- liftIO $ putStrLn $ fromMaybe "" $ M.lookup g m
- next $ return True
-
-performSet :: Group -> String -> CommandPerform
-performSet g expr = case checkPreferredContentExpression expr of
- Just e -> error $ "Parse error: " ++ e
- Nothing -> do
- groupPreferredContentSet g expr
- next $ return True