1 class Tabulate < Formula
2 desc "Table Maker for Modern C++"
3 homepage "https://github.com/p-ranav/tabulate"
4 url "https://github.com/p-ranav/tabulate/archive/refs/tags/v1.5.tar.gz"
5 sha256 "16b289f46306283544bb593f4601e80d6ea51248fde52e910cc569ef08eba3fb"
8 "BSL-1.0", # {optional,string_view,variant}_lite.hpp
9 "BSD-3-Clause", # termcolor.hpp
13 sha256 cellar: :any_skip_relocation, all: "636ac9d2ecadd40138dc030e967b464b296cba28f5eb180377c7e18d18778f97"
16 depends_on "cmake" => :build
19 system "cmake", "-S", ".", "-B", "build", *std_cmake_args
20 system "cmake", "--build", "build"
21 system "cmake", "--install", "build"
25 # https://github.com/p-ranav/tabulate/blob/master/samples/shape.cpp
26 (testpath/"test.cpp").write <<~CPP
27 #include <tabulate/table.hpp>
28 using namespace tabulate;
29 using Row_t = Table::Row_t;
31 void print_shape(Table &table) {
32 auto shape = table.shape();
33 std::cout << "Shape: (" << shape.first << ", " << shape.second << ")" << std::endl;
38 table.add_row(Row_t{"Command", "Description"});
39 table.add_row(Row_t{"git status", "List all new or modified files"});
40 table.add_row(Row_t{"git diff", "Show file differences that haven't been staged"});
41 std::cout << table << std::endl;
45 system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test"
46 assert_match "Shape: (63, 7)", shell_output("./test")