git-annex/Command/GroupWanted.hs
Joey Hess 4781ca297b
showStart variant for when there's no worktree file
Clean up some uses of showStart with "" for the file,
or in some cases, a non-filename description string. That would
generate bad json, although none of the commands doing that
supported --json.

Using "" for the file resulted in output like "foo  rest";
now the extra space is eliminated.

This commit was sponsored by Fernando Jimenez on Patreon.
2017-11-28 15:14:16 -04:00

29 lines
750 B
Haskell

{- git-annex command
-
- Copyright 2015 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.GroupWanted where
import Command
import Logs.PreferredContent
import Command.Wanted (performGet, performSet)
cmd :: Command
cmd = noMessages $ command "groupwanted" SectionSetup
"get or set groupwanted expression"
(paramPair paramGroup (paramOptional paramExpression))
(withParams seek)
seek :: CmdParams -> CommandSeek
seek = withWords start
start :: [String] -> CommandStart
start (g:[]) = next $ performGet groupPreferredContentMapRaw g
start (g:expr:[]) = do
allowMessages
showStart' "groupwanted" (Just g)
next $ performSet groupPreferredContentSet expr g
start _ = giveup "Specify a group."