ndmitchell / ndmitchell/hoogle

Difficult to use custom database path for search

Open
#122 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

fixed in v5
Dominant language
Haskell
Stars
803
Forks
152
PR merge metrics
No merged PRs in 30d

Description

(Haskell + hoogle newbie here, please be aware!)

What I wanted:
Download hoogle database for offline use.

What I tried:
Generate database (worked fine, the --datadir option was documented in hoogle data --help):

hoogle data --datadir=$HOME/.hoogle-datadir

Search, using my --datadir (didn't work):

$ hoogle --datadir=$HOME/.hoogle-datadir map
Unknown flag: --datadir

Uh oh, why doesn't it understand --datadir now?

I installed hoogle with the nix package manager, so the installation directory is read-only. I need the custom datadir not just for having multiple databases on my system, but it is the only way to use the program:

$ hoogle data
hoogle: /nix/store/mdvxcf25a0gr6lrbnwv6waisanrhbc81-haskell-hoogle-4.2.41/share/x86_64-linux-ghc-7.10.1/hoogle-4.2.41/databases: createDirectory: permission denied (Read-only file system)

Workaround
Because I couldn't find a way to tell hoogle to use --datadir= for searching, I made a wrapper script that uses cd $datadir && exec hoogle ....

Solution
What I think should have been needed to be done. Configure datadir with one of these options:

$ echo "datadir=$HOME/.hoogle-datadir" >> ~/.hooglerc
$ export HOOGLE_DATADIR=$HOME/.hoogle-datadir
(or all commands that use the database/datadir accept the --datadir=... option)

Now search:

$ hoogle data
$ hoogle <search>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the option handling for hoogle data --datadir with the search invocation, then check the configuration examples in the issue. The change is complete when a database in a custom datadir can be generated and searched without changing directories, using either the documented configuration or a supported command-line option.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.