Skip to content

Commit 45c0826

Browse files
authored
Merge pull request #51 from lucocozz/group_desc
Remove GROUP_DESC and pedantic option on lib build
2 parents a6e9e16 + a89202a commit 45c0826

File tree

12 files changed

+47
-41
lines changed

12 files changed

+47
-41
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Support for variadic positional arguments, allowing multiple values for a single positional argument.
1313

1414
### Changed
15-
- Change `ARGUS_RELEASE` into `ARGUS_DEBUG`
15+
- Changed help output DEFAULT_MAX_LINE_WIDTH from 80 to 100.
16+
- Changed `ARGUS_RELEASE` into `ARGUS_DEBUG`
1617

1718
### Fixed
19+
- Disabled pedantic option on library compilation.
1820
- Defining `argus_init()` as a `static inline` function.
1921

22+
### Removed
23+
- Group description option.
24+
25+
2026
## [0.1.0] - 2025-07-02
2127

2228
### Added

benchmarks/benchmark_release_mode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ ARGUS_OPTIONS(
1212
HELP_OPTION(),
1313
VERSION_OPTION(),
1414

15-
GROUP_START("Input Options", GROUP_DESC("Options related to input")),
15+
GROUP_START("Input Options"),
1616
OPTION_FLAG('v', "verbose", HELP("Enable verbose output")),
1717
OPTION_STRING('i', "input", HELP("Input file"), DEFAULT("input.txt")),
1818
OPTION_ARRAY_STRING('I', "include", HELP("Include files"), FLAGS(FLAG_SORTED | FLAG_UNIQUE)),
1919
GROUP_END(),
2020

21-
GROUP_START("Output Options", GROUP_DESC("Options related to output")),
21+
GROUP_START("Output Options"),
2222
OPTION_STRING('o', "output", HELP("Output file"), DEFAULT("output.txt")),
2323
OPTION_STRING('f', "format", HELP("Output format"),
2424
VALIDATOR(V_CHOICE_STR("text", "json", "xml", "binary"))),
2525
OPTION_FLAG('s', "silent", HELP("Suppress output"), CONFLICT("verbose")),
2626
GROUP_END(),
2727

28-
GROUP_START("Processing Options", GROUP_DESC("Options controlling processing")),
28+
GROUP_START("Processing Options"),
2929
OPTION_INT('l', "level", HELP("Processing level"),
3030
VALIDATOR(V_RANGE(1, 10)), DEFAULT(5)),
3131
OPTION_INT('j', "jobs", HELP("Number of parallel jobs"),
@@ -35,7 +35,7 @@ ARGUS_OPTIONS(
3535
OPTION_MAP_STRING('D', "define", HELP("Define variables"), FLAGS(FLAG_SORTED_KEY)),
3636
GROUP_END(),
3737

38-
GROUP_START("Advanced Options", GROUP_DESC("Advanced configuration")),
38+
GROUP_START("Advanced Options"),
3939
OPTION_FLAG('d', "debug", HELP("Enable debug mode")),
4040
OPTION_STRING('c', "config", HELP("Configuration file")),
4141
OPTION_ARRAY_INT('p', "ports", HELP("Port numbers"), FLAGS(FLAG_SORTED | FLAG_UNIQUE)),

docs/docs/appendices/cheat-sheet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ endpoint_t *ep = (endpoint_t*)argus_get(&argus, "endpoint").as_ptr;
260260
## // Groups
261261
262262
```c
263-
GROUP_START("Connection", GROUP_DESC("Network options")),
263+
GROUP_START("Connection"),
264264
OPTION_STRING('h', "host", HELP("Hostname")),
265265
OPTION_INT('p', "port", HELP("Port")),
266266
GROUP_END(),
267267
268-
GROUP_START("Output", GROUP_DESC("Output options")),
268+
GROUP_START("Output"),
269269
OPTION_STRING('o', "output", HELP("Output file")),
270270
OPTION_STRING('f', "format", HELP("Format")),
271271
GROUP_END(),

docs/docs/fundamentals/help-and-errors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ ARGUS_OPTIONS(
207207
options,
208208
HELP_OPTION(),
209209

210-
GROUP_START("Connection", GROUP_DESC("Network connection options")),
210+
GROUP_START("Connection"),
211211
OPTION_STRING('H', "host", HELP("Server hostname"), DEFAULT("localhost")),
212212
OPTION_INT('p', "port", HELP("Server port"), DEFAULT(8080)),
213213
OPTION_FLAG('s', "secure", HELP("Use HTTPS")),
214214
GROUP_END(),
215215

216-
GROUP_START("Output", GROUP_DESC("Output formatting options")),
216+
GROUP_START("Output"),
217217
OPTION_STRING('f', "format", HELP("Output format"), DEFAULT("json")),
218218
OPTION_FLAG('v', "verbose", HELP("Verbose output")),
219219
GROUP_END(),
@@ -538,14 +538,14 @@ ARGUS_OPTIONS(
538538
HELP_OPTION(),
539539

540540
// Input/Output options
541-
GROUP_START("Input/Output", GROUP_DESC("File and data handling options")),
541+
GROUP_START("Input/Output"),
542542
OPTION_STRING('i', "input", HELP("Input file or directory")),
543543
OPTION_STRING('o', "output", HELP("Output destination")),
544544
OPTION_STRING('f', "format", HELP("Output format")),
545545
GROUP_END(),
546546

547547
// Processing options
548-
GROUP_START("Processing", GROUP_DESC("Algorithm and performance options")),
548+
GROUP_START("Processing"),
549549
OPTION_INT('t', "threads", HELP("Worker threads")),
550550
OPTION_FLOAT('q', "quality", HELP("Processing quality")),
551551
OPTION_FLAG('F', "fast", HELP("Use fast mode (lower quality)")),

examples/advanced_options.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ ARGUS_OPTIONS(
1818
OPTION_STRING('i', "input", HELP("Input file"), FLAGS(FLAG_REQUIRED)),
1919

2020
// Compression options in an exclusive group (only one can be selected)
21-
GROUP_START("Compression", GROUP_DESC("Compression options"),
22-
FLAGS(FLAG_EXCLUSIVE)),
21+
GROUP_START("Compression", FLAGS(FLAG_EXCLUSIVE)),
2322
OPTION_FLAG('z', "gzip", HELP("Use gzip compression")),
2423
OPTION_FLAG('j', "bzip2", HELP("Use bzip2 compression")),
2524
OPTION_FLAG('Z', "lzma", HELP("Use lzma compression")),

includes/argus/internal/display.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
/*
1616
* Default configuration constants for display formatting
1717
*/
18-
#define DEFAULT_DESCRIPTION_COLUMN 32 // Column where descriptions start
19-
#define DEFAULT_MAX_LINE_WIDTH 80 // Maximum width of a line
20-
#define DEFAULT_OPTION_INDENT 2 // Indentation for options
18+
#define DEFAULT_DESCRIPTION_COLUMN 32 // Column where descriptions start
19+
#define DEFAULT_MAX_LINE_WIDTH 100 // Maximum width of a line
20+
#define DEFAULT_OPTION_INDENT 2 // Indentation for options
2121

2222
/*
2323
* Default Smart Hint configuration

includes/argus/internal/help.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ typedef struct option_entry_s
3131
typedef struct group_info_s
3232
{
3333
const char *name;
34-
const char *description;
3534
option_entry_t *options;
3635
struct group_info_s *next;
3736
} group_info_t;
@@ -68,10 +67,9 @@ void add_option_to_list(option_entry_t **list, const argus_option_t *option);
6867
*
6968
* @param data Help data structure
7069
* @param name Group name
71-
* @param description Group description
7270
* @return Group info structure or NULL on failure
7371
*/
74-
group_info_t *find_or_create_group(help_data_t *data, const char *name, const char *description);
72+
group_info_t *find_or_create_group(help_data_t *data, const char *name);
7573

7674
/**
7775
* Organize options into categories for display

includes/argus/options.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ ARGUS_API char *format_choices_validator(validator_data_t data);
6767
* Optional option fields macros
6868
*/
6969
#ifdef ARGUS_DEBUG
70-
# define ARGUS_DEBUG_INFO() .line = __LINE__, .file = __FILE__
70+
# define ARGUS_DEBUG_INFO .line = __LINE__, .file = __FILE__
7171
#else
72-
# define ARGUS_DEBUG_INFO() .line = 0, .file = NULL
72+
# define ARGUS_DEBUG_INFO .line = 0, .file = NULL
7373
#endif /* ARGUS_DEBUG */
7474
#define DEFINE_NAME(lname, sname) ((lname) ? (lname) : CHAR_TO_STRING(sname))
7575
#define DEFAULT(val) .value = (argus_value_t){ .raw = (uintptr_t)(val) }, \
@@ -82,7 +82,6 @@ ARGUS_API char *format_choices_validator(validator_data_t data);
8282
#define HINT(_hint) .hint = _hint
8383
#define REQUIRE(...) .require = (const char*[]){__VA_ARGS__, NULL}
8484
#define CONFLICT(...) .conflict = (const char*[]){__VA_ARGS__, NULL}
85-
#define GROUP_DESC(desc) .help = desc
8685
#define HELP(desc) .help = desc
8786
#define FLAGS(_flags) .flags = _flags
8887
#define ENV_VAR(name) .env_name = name
@@ -143,30 +142,30 @@ ARGUS_API char *format_choices_validator(validator_data_t data);
143142
.type = TYPE_NONE, \
144143
.name = NULL, \
145144
.value_type = VALUE_TYPE_NONE, \
146-
ARGUS_DEBUG_INFO() \
145+
ARGUS_DEBUG_INFO \
147146
}
148147

149148
#define OPTION_BASE(_short, _long, _value_type, ...) \
150149
(argus_option_t) { \
151150
.type = TYPE_OPTION, .name = DEFINE_NAME(_long, _short), \
152151
.sname = _short, .lname = _long, .value_type = _value_type, \
153-
.free_handler = default_free, ARGUS_DEBUG_INFO(), ##__VA_ARGS__ \
152+
.free_handler = default_free, ARGUS_DEBUG_INFO, ##__VA_ARGS__ \
154153
}
155154

156155
#define POSITIONAL_BASE(_name, _value_type, ...) \
157156
(argus_option_t) { \
158157
.type = TYPE_POSITIONAL, .name = _name, .value_type = _value_type, \
159-
.free_handler = default_free, .flags = FLAG_REQUIRED, ARGUS_DEBUG_INFO(), ##__VA_ARGS__ \
158+
.free_handler = default_free, .flags = FLAG_REQUIRED, ARGUS_DEBUG_INFO, ##__VA_ARGS__ \
160159
}
161160

162161
#define GROUP_BASE(_name, ...) \
163162
(argus_option_t) { \
164-
.type = TYPE_GROUP, .name = _name, ARGUS_DEBUG_INFO(), ##__VA_ARGS__ \
163+
.type = TYPE_GROUP, .name = _name, ARGUS_DEBUG_INFO, ##__VA_ARGS__ \
165164
}
166165

167166
#define SUBCOMMAND_BASE(_name, sub_opts, ...) \
168167
(argus_option_t) { \
169-
.type = TYPE_SUBCOMMAND, .name = _name, .sub_options = sub_opts, ARGUS_DEBUG_INFO(), ##__VA_ARGS__ \
168+
.type = TYPE_SUBCOMMAND, .name = _name, .sub_options = sub_opts, ARGUS_DEBUG_INFO, ##__VA_ARGS__ \
170169
}
171170

172171
// clang-format on

meson.build

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,18 @@ argus_lib = both_libraries(
5656
install: true,
5757
vs_module_defs: 'argus.def',
5858
)
59+
dep_compile_args = []
60+
if cc.get_id() == 'gcc'
61+
dep_compile_args = ['-Wno-pedantic']
62+
elif cc.get_id() == 'clang'
63+
dep_compile_args = ['-Wno-gnu-zero-variadic-macro-arguments']
64+
endif
5965

6066
argus_dep = declare_dependency(
6167
link_with: argus_lib,
6268
include_directories: inc_dirs,
6369
dependencies: regex ? [pcre2_dep] : [],
70+
compile_args: dep_compile_args,
6471
)
6572

6673
install_headers('includes/argus.h')

source/display/help/help_organizer.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void add_option_to_list(option_entry_t **list, const argus_option_t *option)
4343
}
4444
}
4545

46-
group_info_t *find_or_create_group(help_data_t *data, const char *name, const char *description)
46+
group_info_t *find_or_create_group(help_data_t *data, const char *name)
4747
{
4848
group_info_t *group = data->groups;
4949
while (group != NULL) {
@@ -56,10 +56,9 @@ group_info_t *find_or_create_group(help_data_t *data, const char *name, const ch
5656
if (!group)
5757
return NULL;
5858

59-
group->name = name;
60-
group->description = description;
61-
group->options = NULL;
62-
group->next = NULL;
59+
group->name = name;
60+
group->options = NULL;
61+
group->next = NULL;
6362

6463
if (data->groups == NULL)
6564
data->groups = group;
@@ -75,18 +74,16 @@ group_info_t *find_or_create_group(help_data_t *data, const char *name, const ch
7574

7675
void organize_options(const argus_option_t *options, help_data_t *data)
7776
{
78-
const char *current_group = NULL;
79-
const char *current_group_desc = NULL;
80-
group_info_t *group = NULL;
77+
const char *current_group = NULL;
78+
group_info_t *group = NULL;
8179

8280
for (int i = 0; options[i].type != TYPE_NONE; ++i) {
8381
const argus_option_t *option = &options[i];
8482

8583
switch (option->type) {
8684
case TYPE_GROUP:
87-
current_group = option->name;
88-
current_group_desc = option->help;
89-
group = NULL;
85+
current_group = option->name;
86+
group = NULL;
9087
break;
9188

9289
case TYPE_OPTION:
@@ -95,7 +92,7 @@ void organize_options(const argus_option_t *options, help_data_t *data)
9592

9693
if (current_group != NULL) {
9794
if (group == NULL)
98-
group = find_or_create_group(data, current_group, current_group_desc);
95+
group = find_or_create_group(data, current_group);
9996
add_option_to_list(&group->options, option);
10097
} else
10198
add_option_to_list(&data->ungrouped, option);

0 commit comments

Comments
 (0)