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