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.0.0.tar.gz"
|
|
sha256 "2c672f17bf56e8e6223a3bfb74055a946fa7b1ff376510371902adb9cb0ab6a3"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/CLIUtils/CLI11.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "4dcc37a06d7c5bbb42aedacda62065c2006de9bbf471fab39a96526aef318da9"
|
|
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
|