ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
lib/options/registry/common.h
Go to the documentation of this file.
1
9
10#pragma once
11
14#include <stdbool.h>
15#include <stddef.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
32typedef const void *(*mode_default_getter_fn)(asciichat_mode_t mode);
33
37typedef struct {
38 const char *long_name;
41 size_t offset;
42 const void *default_value;
44 const char *help_text;
45 const char *group;
46 const char *arg_placeholder;
48 const char *env_var_name;
49 bool (*validate_fn)(const void *options_struct);
50 bool (*parse_fn)(const char *arg, void *dest, char **error_msg);
59
64typedef struct {
66 const char *name;
68
73#define REGISTRY_TERMINATOR() \
74 {.long_name = NULL, \
75 .short_name = '\0', \
76 .type = OPTION_TYPE_BOOL, \
77 .offset = 0, \
78 .default_value = NULL, \
79 .mode_default_getter = NULL, \
80 .default_value_size = 0, \
81 .help_text = NULL, \
82 .group = NULL, \
83 .arg_placeholder = NULL, \
84 .required = false, \
85 .env_var_name = NULL, \
86 .validate_fn = NULL, \
87 .parse_fn = NULL, \
88 .owns_memory = false, \
89 .optional_arg = false, \
90 .mode_bitmask = OPTION_MODE_NONE, \
91 .metadata = {0}}
92
93#ifdef __cplusplus
94}
95#endif
Options builder API for flexible command-line option configuration.
option_type_t
Custom help section descriptor.
Definition builder.h:170
asciichat_mode_t
Mode type for options parsing.
Definition options.h:916
option_mode_bitmask_t
Option mode bitmask.
Definition options.h:933
const void *(* mode_default_getter_fn)(asciichat_mode_t mode)
Temporary builder for a help/category index. name identifies the category and entries points at the e...
⚙️ Unified options parsing system for ascii-chat with builder pattern and lock-free access
Registry entry - stores option definition with mode bitmask and metadata.
const registry_entry_t * entries
Completion metadata attached to one option descriptor.
Definition builder.h:201
Registry entry - stores option definition with mode bitmask and metadata.
option_type_t type
const char * group
bool optional_arg
bool required
bool owns_memory
bool(* validate_fn)(const void *options_struct)
size_t default_value_size
mode_default_getter_fn mode_default_getter
Mode-aware default getter (NULL if using default_value) - LAST for backward compat.
const char * help_text
option_mode_bitmask_t mode_bitmask
const char * arg_placeholder
Custom argument placeholder (e.g., "SHELL [FILE]" instead of "STR").
const void * default_value
Default value (single value for all modes, or NULL if mode_default_getter is set).
const char * env_var_name
option_metadata_t metadata
Enum values, numeric ranges, examples.
char short_name
const char * long_name
bool(* parse_fn)(const char *arg, void *dest, char **error_msg)
size_t offset