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