summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CmdLine/GitAnnex.hs10
-rw-r--r--Command/Whereis.hs16
2 files changed, 15 insertions, 11 deletions
diff --git a/CmdLine/GitAnnex.hs b/CmdLine/GitAnnex.hs
index 2990a6c38..68a9e27ca 100644
--- a/CmdLine/GitAnnex.hs
+++ b/CmdLine/GitAnnex.hs
@@ -15,7 +15,7 @@ import Command
import Utility.Env
import Annex.Ssh
---import qualified Command.Help
+import qualified Command.Help
import qualified Command.Add
import qualified Command.Unannex
import qualified Command.Drop
@@ -58,7 +58,7 @@ import qualified Command.Lock
import qualified Command.PreCommit
import qualified Command.Find
--import qualified Command.FindRef
---import qualified Command.Whereis
+import qualified Command.Whereis
--import qualified Command.List
--import qualified Command.Log
import qualified Command.Merge
@@ -119,8 +119,8 @@ import System.Remote.Monitoring
cmds :: [Command]
cmds =
--- [ Command.Help.cmd
- [ Command.Add.cmd
+ [ Command.Help.cmd
+ , Command.Add.cmd
, Command.Get.cmd
, Command.Drop.cmd
, Command.Move.cmd
@@ -185,7 +185,7 @@ cmds =
, Command.AddUnused.cmd
, Command.Find.cmd
-- , Command.FindRef.cmd
--- , Command.Whereis.cmd
+ , Command.Whereis.cmd
-- , Command.List.cmd
-- , Command.Log.cmd
, Command.Merge.cmd
diff --git a/Command/Whereis.hs b/Command/Whereis.hs
index 2c6018b24..3610eed78 100644
--- a/Command/Whereis.hs
+++ b/Command/Whereis.hs
@@ -19,21 +19,25 @@ cmd :: Command
cmd = noCommit $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
command "whereis" SectionQuery
"lists repositories that have file content"
- paramPaths (withParams seek)
+ paramPaths (seek <$$> optParser)
data WhereisOptions = WhereisOptions
{ whereisFiles :: CmdParams
- , jsonOption :: GlobalSetter
, keyOptions :: Maybe KeyOptions
}
-seek :: CmdParams -> CommandSeek
-seek ps = do
+optParser :: CmdParamsDesc -> Parser WhereisOptions
+optParser desc = WhereisOptions
+ <$> cmdParams desc
+ <*> optional (parseKeyOptions False)
+
+seek :: WhereisOptions -> CommandSeek
+seek o = do
m <- remoteMap id
- withKeyOptions False
+ withKeyOptions (keyOptions o) False
(startKeys m)
(withFilesInGit $ whenAnnexed $ start m)
- ps
+ (whereisFiles o)
start :: M.Map UUID Remote -> FilePath -> Key -> CommandStart
start remotemap file key = start' remotemap key (Just file)