Brew公式安装选项



我正在尝试为Brew编写公式,允许用户选择加入/退出正在安装的工具的某些功能。我找不到任何文件证明这是否可行。

更具体地说,我想让开发人员选择退出崩溃报告,然后公式可以决定使用哪个源或类似的东西。

配方食谱¶添加可选步骤可能对您有所帮助:

如果要添加option:

class Yourformula < Formula
...
option "with-ham", "Description of the option"
option "without-spam", "Another description"
depends_on "foo" => :optional  # will automatically add a with-foo option
...

然后定义option的影响:

if build.with? "ham"
# note, no "with" in the option name (it is added by the build.with? method)
end
if build.without? "ham"
# works as you'd expect. True if `--without-ham` was given.
end

最新更新