opam - 如何使用 ocamlfind 或 opam 获取已安装软件包的版本?
问题描述
在我的配置脚本中,我需要<package>
使用ocamlfind
或检查软件包的安装版本opam
。我如何获得这些信息?
解决方案
使用 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:.
推荐阅读
- ios - 当 z-index 设置为非零值时,未在视图上调用触摸代理
- java - Java接口和类中的多个泛型
- css - css 圆形边框大小与空白和抗锯齿
- javascript - 如何修改谷歌应用脚本中的链接
- java - 如何将任意 JSON 字符串反序列化为 java POJO?
- three.js - 在 Blender 中未应用缩放时修复 Three.js 模型
- sql - SQLite - 使用通配符加入
- url - 在 VBScript 中解析 URL
- google-cloud-platform - 如何解决 Google Dataflow 中的稳定性问题
- sql - 组合复杂数据透视表中的列