@@ -190,10 +190,10 @@ cleanPkg copts fp = do
190190--
191191-- Issue number #1572 on the issue tracker
192192-- https://github.com/idris-lang/Idris-dev/issues/1572
193−documentPkg :: [Opt] -- ^ Command line options.
194− -> FilePath -- ^ Path to ipkg file.
193+documentPkg :: [Opt] -- ^ Command line options.
194+ -> (Bool,FilePath) -- ^ (Should we install?, Path to ipkg file).
195195 -> IO ()
196−documentPkg copts fp = do
196+documentPkg copts (install,fp) = do
197197 pkgdesc <- parseDesc fp
198198 cd <- getCurrentDirectory
199199 let pkgDir = cd </> takeDirectory fp
@@ -223,7 +223,13 @@ documentPkg copts fp = do
223223 putStrLn $ pshow idrisInit err
224224 exitWith (ExitFailure 1)
225225 Right ist -> do
226− docRes <- generateDocs ist mods outputDir
226+ iDocDir <- getIdrisDocDir
227+ pkgDocDir <- makeAbsolute (iDocDir </> pkgname pkgdesc)
228+ let out_dir = if install then pkgDocDir else outputDir
229+ when install $ do
230+ putStrLn $ unwords ["Attempting to install IdrisDocs for", pkgname pkgdesc, "in:", out_dir]
231+
232+ docRes <- generateDocs ist mods out_dir
227233 case docRes of
228234 Right _ -> return ()
229235 Left msg -> do
@@ -416,14 +422,15 @@ mergeOptions copts popts =
416422 normaliseOpts = filter filtOpt
417423
418424 filtOpt :: Opt -> Bool
419− filtOpt (PkgBuild _) = False
420− filtOpt (PkgInstall _) = False
421− filtOpt (PkgClean _) = False
422− filtOpt (PkgCheck _) = False
423− filtOpt (PkgREPL _) = False
424− filtOpt (PkgMkDoc _) = False
425− filtOpt (PkgTest _) = False
426− filtOpt _ = True
425+ filtOpt (PkgBuild _) = False
426+ filtOpt (PkgInstall _) = False
427+ filtOpt (PkgClean _) = False
428+ filtOpt (PkgCheck _) = False
429+ filtOpt (PkgREPL _) = False
430+ filtOpt (PkgDocBuild _) = False
431+ filtOpt (PkgDocInstall _) = False
432+ filtOpt (PkgTest _) = False
433+ filtOpt _ = True
427434
428435 chkOpt :: Opt -> Either String Opt
429436 chkOpt o@(OLogging _) = Right o