从Hoogle命令行访问功能的文档 [英] Accessing documentation for a function from Hoogle command line

查看:103
本文介绍了从Hoogle命令行访问功能的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hoogle网站上搜索功能时,会看到与其关联的文档,例如:

  mod :: a  - > a  - >一个infixl 7 

整数模数,满足

(x`div` y)* y +(x`mod` y)== x

Hoogle也作为命令行可执行文件存在。据我所知,它只显示函数的签名:

 〜❯❯❯ hoogle --info Prelude.mod 
Prelude mod :: Integral a => a - > a - > a

从包基础
mod :: Integral a => a - > a - > a

有没有办法通过命令行获取相关文档,就像在线版本一样? 使用 -i 选项。 如何获得对默认命令( search )的帮助并不明显。这里是如何做到的:

  $ hoogle search --help 
Hoogle v4 .2.41,(C)Neil Mitchell 2004-2012
http://haskell.org/hoogle

hoogle [搜索] [选项] [QUERY]
执行搜索

标志:
-c --colour --color使用彩色输出(需要ANSI终端)
-l --link给出每个结果的URL
-i - -info提供有关第一个结果的扩展信息
-e --exact完全匹配搜索时的名称
-d --databases = DIR目录搜索数据库
-s --start = INT从(1基)开始显示结果(
-n --count = INT返回结果的最大数量
-w --web [= MODE]作为web工具运行
-r --repeat = INT多次运行搜索(用于基准测试)
常用标志:
- ? --help显示帮助信息
-V --version打印版本信息
--numeric-version只显示版本号
-v --verbose大声的详细程度
-q - -quiet Quiet verbities


When searching for a function on the Hoogle website, one sees the documentation associated with it, e.g.:

mod :: a -> a -> a            infixl 7

    integer modulus, satisfying

    (x `div` y)*y + (x `mod` y) == x

Hoogle also exists as a command line executable. As far as I know, it only shows the signature of the function:

~ ❯❯❯ hoogle --info Prelude.mod
Prelude mod :: Integral a => a -> a -> a

From package base
mod :: Integral a => a -> a -> a

Is there a way to get the associated documentation through the command line, as in the online version?

解决方案

Use the -i option. It is not obvious how to get help for the default command (search); here is how to do it:

$ hoogle search --help
Hoogle v4.2.41, (C) Neil Mitchell 2004-2012
http://haskell.org/hoogle

hoogle [search] [OPTIONS] [QUERY]
  Perform a search

Flags:
  -c --colour --color   Use colored output (requires ANSI terminal)
  -l --link             Give URL's for each result
  -i --info             Give extended information about the first result
  -e --exact            Match names exactly when searching
  -d --databases=DIR    Directories to search for databases
  -s --start=INT        Start displaying results from this point on (1 based)
  -n --count=INT        Maximum number of results to return
  -w --web[=MODE]       Operate as a web tool
  -r --repeat=INT       Run the search multiple times (for benchmarking)
Common flags:
  -? --help             Display help message
  -V --version          Print version information
     --numeric-version  Print just the version number
  -v --verbose          Loud verbosity
  -q --quiet            Quiet verbosity

这篇关于从Hoogle命令行访问功能的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆