@@ -1,7 +1,6 @@
1−module Idris.IdrisDoc (generateDocs, DocTarget) where
1+module Idris.IdrisDoc (generateDocs, DocTarget (..), idrisDocUsage) where
3import Idris.AbsSyntax (IState)
3import Idris.AbsSyntax (IState)
4−import Idris.Core.TT (Err')
6type Failable = Either String
5type Failable = Either String
@@ -9,13 +8,20 @@ type Failable = Either String
9-- t: What do generate documentation for
8-- t: What do generate documentation for
10-- ot: Where to output documentation
9-- ot: Where to output documentation
11-- trm: Trace mode? (will generate documentation for referred modules)
10-- trm: Trace mode? (will generate documentation for referred modules)
12−generateDocs :: IState -> DocTarget -> Filepath -> Bool -> IO (Either String ())
11+generateDocs :: IState -> DocTarget -> FilePath -> Bool -> IO (Either String ())
13−generateDocs ist t ot trm = error "IdrisDoc has not been implemented yet..."
12+generateDocs ist t ot trm = err "IdrisDoc has not been implemented yet..."
15−error :: String -> IO (Failable ())
14+err :: String -> IO (Failable ())
16−error s = return Left s
15+err s = return $ Left s
18-- Target to generate documentation for
17-- Target to generate documentation for
19-- Namespace ns: Generate documentation for the namespace identified by 'ns'
18-- Namespace ns: Generate documentation for the namespace identified by 'ns'
20-- Dir d: Generate documentation for all namespaces in the directory 'd'
19-- Dir d: Generate documentation for all namespaces in the directory 'd'
21−data DocTarget = Namespace String | Dir FilePath
20+data DocTarget = Namespace String | Dir FilePath
22+idrisDocUsage = "Usage: :mkdoc [notrace] [ns | dir] [TARGET]\n\n" ++
23+ "notrace: Do not generate IdrisDoc for addtionally referred namespaces.\n" ++
24+ "ns: TARGET is a loaded namespace. TARGET required.\n" ++
25+ "dir: TARGET is a directory to search recursively for .idr files. TARGET required.\n" ++
26+ "TARGET: What to generate IdrisDoc for. By default interpreted as a namespace.\n" ++
27+ "<none>: Same as ':mkdoc dir .'"