From 8638099c498226c8ec5d193573dd5df392b27815 Mon Sep 17 00:00:00 2001 From: v1nh1shungry Date: Thu, 28 Jul 2022 14:50:14 +0800 Subject: [PATCH] add cmdline (#1368) --- packages/c/cmdline/xmake.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/c/cmdline/xmake.lua diff --git a/packages/c/cmdline/xmake.lua b/packages/c/cmdline/xmake.lua new file mode 100644 index 000000000..1c28a7c63 --- /dev/null +++ b/packages/c/cmdline/xmake.lua @@ -0,0 +1,27 @@ +package("cmdline") + + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/tanakh/cmdline") + set_description("A Command Line Parser") + set_license("BSD-3-Clause") + + add_urls("https://github.com/tanakh/cmdline.git") + add_versions("2014.2.4", "e4cd007fb8f0314002d9a5b4d82939106e4144e4") + + on_install("linux", "macosx", "bsd", "mingw", function (package) + os.cp("cmdline.h", package:installdir("include")) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + using namespace std; + static void test() { + cmdline::parser a; + a.add("host", 'h', "host name", true, ""); + a.add("port", 'p', "port number", false, 80, cmdline::range(1, 65535)); + a.add("type", 't', "protocol type", false, "http", cmdline::oneof("http", "https", "ssh", "ftp")); + a.add("gzip", '\0', "gzip when transfer"); + } + ]]})) + end)