Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
mini-args
一个极简的 C++17 命令行参数解析头文件库(single-header,无依赖)。
特性
args.hpp,直接#include即可--key=value、--key value、-k value、-k=value、裸标志--flagint、double、std::string等类型的自动转换(基于std::from_chars)std::optional,支持设置默认值--之后全部视为位置参数-开头的参数会被当作该选项的值,建议布尔标志放最后、使用=形式,或用--分隔位置参数使用
完整示例见
example.cpp:License
Copyright 2026 程哲熙 24377148
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.