git-annex/Command/Describe.hs
Joey Hess 0033e6c0a6
Tab completion of many commands like info and trust now includes remotes
Especially useful with proxied remotes and clusters, where the user may not
be entirely familiar with the name and can learn by tab completion.
2024-06-30 12:39:18 -04:00

36 lines
912 B
Haskell

{- git-annex command
-
- Copyright 2011 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
module Command.Describe where
import Command
import qualified Remote
import Logs.UUID
cmd :: Command
cmd = command "describe" SectionSetup
"change description of a repository"
(paramPair paramRepository paramDesc)
(withParams' seek completeRemotes)
seek :: CmdParams -> CommandSeek
seek = withWords (commandAction . start)
start :: [String] -> CommandStart
start (name:description) | not (null description) = do
u <- Remote.nameToUUID name
let ai = ActionItemUUID u (UnquotedString name)
starting "describe" ai si $
perform u $ unwords description
where
si = SeekInput [name]
start _ = giveup "Specify a repository and a description."
perform :: UUID -> String -> CommandPerform
perform u description = do
describeUUID u (toUUIDDesc description)
next $ return True