[英]How to get the version of a installed package using ocamlfind or opam?
In my configure script, I need to check the installed version of a package <package>
using ocamlfind
or opam
.在我的配置脚本中,我需要使用
ocamlfind
或opam
检查 package <package>
的安装版本。 How do I get this information?我如何获得这些信息?
ocamlfind query -format %v <package>
ocamlfind query -format %v <package>
This information is not directly available when running ocamlfind query --help
, but it is available with ocamlfind query -help-format
, which displays it among the other format options:此信息在运行
ocamlfind query --help
时不直接可用,但可通过ocamlfind query -help-format
获得,它会在其他格式选项中显示它:
Formats for -format strings: ... %v version...
opam info -f installed-version <package>
opam info -f installed-version <package>
It returns --
when the package is not installed.它返回
--
当 package 未安装时。
This comes from opam info --help
:这来自
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 (:), eg --field=depopts:.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.