feat(argparse): 新增命令行参数解析库

新增 argparse 库的基础框架,包含以下组件:

- 创建了 argparse 库的 cbuild.toml 配置文件,定义包信息和依赖关系
- 实现了核心的参数解析功能,包括 optparse.h 和 optparse.c
- 定义了参数解析相关的数据结构和枚举类型
- 实现了完整的命令行选项解析逻辑,支持长短选项、参数绑定等功能
- 添加了全面的单元测试,覆盖各种使用场景和边界情况
- 包含对短选项连写、长选项等号形式、选项终止符等特性的支持
This commit is contained in:
zzy
2026-02-03 12:35:45 +08:00
parent 2a90e165a5
commit d1b215861c
6 changed files with 1003 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#ifndef __SCC_ARGPARSE_H__
#define __SCC_ARGPARSE_H__
#include "optparse.h"
typedef enum {
SCC_ARGPARSE_ERROR_NONE,
} scc_argparse_error_t;
typedef struct {
} scc_argparse_cmd_t;
typedef struct {
} scc_argparse_arg_t;
typedef struct {
const char *name;
const char *description;
const char *epilog;
const char *usage;
const char *help;
scc_optparse_t optparse;
int usage_margin;
int usage_max_width;
int help_vertical_space;
int help_usage_margin;
int help_description_margin;
int help_max_width;
} scc_argparse_t;
#endif /* __SCC_ARGPARSE_H__ */