- 授权协议: MIT
- 开发语言: C/C++
- 操作系统: 跨平台
- 软件首页: https://github.com/muellan/clipp
- 软件文档: https://github.com/muellan/clipp
- 官方下载: https://github.com/muellan/clipp
软件介绍
clipp 是一个现代 C++ 的命令行界面。它易于使用,功能强大,支持 C++ 11/14/17,且项目仅集成在单个头文件中的。
功能支持选项、选项+值、文档路径值、位置命令、嵌套替代、决策树、可连接标志、自定义值过滤等,此外还有文档生成(使用行、手册页)与错误处理。
简单使用示例:
以这个命令行界面为例:
SYNOPSIS convert <input file> [-r] [-o <output format>] [-utf16] OPTIONS -r, --recursive convert files recursively -utf16 use UTF-16 encoding
代码定义了 input file 和三个选项:-r、-o 和 -utf16。如果解析失败,默认使用文档页代码片段将打印到 stdout。
#include <iostream>
#include "clipp.h"
using namespace clipp; using std::cout; using std::string;
int main(int argc, char* argv[]) {
bool rec = false, utf16 = false;
string infile = "", fmt = "csv";
auto cli = (
value("input file", infile),
option("-r", "--recursive").set(rec).doc("convert files recursively"),
option("-o") & value("output format", fmt),
option("-utf16").set(utf16).doc("use UTF-16 encoding")
);
if(!parse(argc, argv, cli)) cout << make_man_page(cli, argv[0]);
// ...
}
The Art of UNIX Programming
Eric S. Raymond / Addison-Wesley / 2003-10-3 / USD 54.99
Writing better software: 30 years of UNIX development wisdom In this book, five years in the making, the author encapsulates three decades of unwritten, hard-won software engineering wisdom. Raymond b......一起来看看 《The Art of UNIX Programming》 这本书的介绍吧!
