41 lines
1.2 KiB
Ruby
41 lines
1.2 KiB
Ruby
class Cli11 < Formula
|
|
desc "Simple and intuitive command-line parser for C++11"
|
|
homepage "https://cliutils.github.io/CLI11/book/"
|
|
url "https://github.com/CLIUtils/CLI11/archive/v2.2.0.tar.gz"
|
|
sha256 "d60440dc4d43255f872d174e416705f56ba40589f6eb07727f76376fb8378fd6"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/CLIUtils/CLI11.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "15c78bce16ca6b628bd375c11032666b1626adfe1aad2aae09dcfa45ff03c15e"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
|
|
def install
|
|
system "cmake", ".", "-DCLI11_BUILD_DOCS=OFF", "-DCLI11_BUILD_TESTS=OFF", *std_cmake_args
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.cpp").write <<~EOS
|
|
#include "CLI/App.hpp"
|
|
#include "CLI/Formatter.hpp"
|
|
#include "CLI/Config.hpp"
|
|
|
|
int main(int argc, char** argv) {
|
|
CLI::App app{"App description"};
|
|
|
|
std::string filename = "default";
|
|
app.add_option("-r,--result", filename, "A test string");
|
|
|
|
CLI11_PARSE(app, argc, argv);
|
|
std::cout << filename << std::endl;
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", "-I#{include}"
|
|
assert_equal "foo\n", shell_output("./test -r foo")
|
|
end
|
|
end
|