在我的配置脚本中,我需要<package>
使用ocamlfind
或检查软件包的安装版本opam
。我如何获得这些信息?
问问题
25 次
1 回答
0
使用 ocamlfind:ocamlfind query -format %v <package>
此信息在运行时不直接可用ocamlfind query --help
,但可与 一起使用ocamlfind query -help-format
,它显示在其他格式选项中:
Formats for -format strings: ... %v version ...
使用 opam:opam info -f installed-version <package>
它--
在未安装软件包时返回。
这来自opam info --help
:
-f FIELDS, --field=FIELDS Only display the values of these fields. Fields can be selected among name, version, package, synopsis, synopsis-or-target, description, <field>:, installed-version, pin, source-hash, opam-file, all-installed-versions, available-versions, all-versions, repository, installed-files, vc-ref, depexts. Multiple fields can be separated with commas, in which case field titles will be printed; the raw value of any opam-file field can be queried by suffixing a colon character (:), e.g. --field=depopts:.
于 2020-05-13T16:51:35.227 回答