blob: f61d764a11f4c47113c4e9174e37d9efa05d25f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
Description: Use Debian's hoogle database
Allow hoogle to fall back to the Debian's global database
if the default doesn't exist.
Author: Ilias Tsitsimpis <i.tsitsimpis@gmail.com>
Forwarded: no, Debian specific
--- a/src/Action/CmdLine.hs
+++ b/src/Action/CmdLine.hs
@@ -80,8 +80,16 @@ getCmdLine args = do
args <- withArgs args $ cmdArgsRun cmdLineMode
-- fill in the default database
+ -- If a database has not been given, and the default does not exist,
+ -- and this is not a generate command, fallback to the Debian database.
args <- if database args /= "" then return args else do
- db <- defaultDatabaseLang $ language args; return args{database=db}
+ db <- defaultDatabaseLang $ language args
+ let debdb = "/var/lib/hoogle/databases/default.hoo"
+ db_exists <- doesFileExist db
+ case args of
+ Generate{..} -> return $ args{database=db}
+ _ | db_exists -> return $ args{database=db}
+ _ -> return $ args{database=debdb}
-- fix up people using Hoogle 4 instructions
args <- case args of
|