ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
option_descriptor_t Struct Reference

Option descriptor. More...

#include <include/ascii-chat/options/builder.h>

Data Fields

const char * long_name
 Long option name (e.g., "port")
 
char short_name
 Short option char (e.g., 'p', or '\0' if none)
 
option_type_t type
 Value type.
 
size_t offset
 offsetof(struct, field) - where to store value
 
const char * help_text
 Description for –help.
 
const char * group
 Group name for help sections (e.g., "NETWORK OPTIONS")
 
const char * arg_placeholder
 Custom argument placeholder (e.g., "SHELL [FILE]" instead of "STR")
 
bool hide_from_mode_help
 If true, don't show in mode-specific help (binary-level only)
 
bool hide_from_binary_help
 If true, don't show in binary-level help (e.g., in release builds)
 
const void * default_value
 Pointer to default value (or NULL if required)
 
bool required
 If true, option must be provided.
 
const char * env_var_name
 Environment variable fallback (or NULL)
 
bool(* validate )(const void *options_struct, char **error_msg)
 
bool(* parse_fn )(const char *arg, void *dest, char **error_msg)
 
void(* action_fn )(void)
 Action to execute (may call exit)
 
bool owns_memory
 If true, strings are strdup'd and freed on cleanup.
 
bool optional_arg
 If true, argument is optional (for callbacks like –verbose)
 
option_mode_bitmask_t mode_bitmask
 Which modes this option applies to.
 
option_metadata_t metadata
 Metadata for shell completions (enums, ranges, examples, etc.)
 
const void *(* mode_default_getter )(asciichat_mode_t mode)
 Get mode-specific default value (NULL if not mode-aware)
 

Detailed Description

Option descriptor.

Describes a single command-line option with all its metadata. Includes both parsing information and completion metadata for generating smart shell completions.

Definition at line 241 of file builder.h.

Field Documentation

◆ action_fn

void(* option_descriptor_t::action_fn) (void)

Action to execute (may call exit)

Definition at line 269 of file builder.h.

Referenced by options_registry_find_by_name(), options_registry_find_by_short(), and registry_entry_to_descriptor().

◆ arg_placeholder

const char* option_descriptor_t::arg_placeholder

Custom argument placeholder (e.g., "SHELL [FILE]" instead of "STR")

Definition at line 253 of file builder.h.

Referenced by get_option_help_placeholder_str(), manpage_content_generate_options(), options_builder_set_arg_placeholder(), and registry_entry_to_descriptor().

◆ default_value

◆ env_var_name

◆ group

◆ help_text

◆ hide_from_binary_help

bool option_descriptor_t::hide_from_binary_help

◆ hide_from_mode_help

bool option_descriptor_t::hide_from_mode_help

◆ long_name

◆ metadata

◆ mode_bitmask

◆ mode_default_getter

const void *(* option_descriptor_t::mode_default_getter) (asciichat_mode_t mode)

Get mode-specific default value (NULL if not mode-aware)

Definition at line 284 of file builder.h.

Referenced by config_schema_build_from_configs(), and registry_entry_to_descriptor().

◆ offset

◆ optional_arg

bool option_descriptor_t::optional_arg

If true, argument is optional (for callbacks like –verbose)

Definition at line 275 of file builder.h.

Referenced by options_registry_find_by_name(), options_registry_find_by_short(), and registry_entry_to_descriptor().

◆ owns_memory

bool option_descriptor_t::owns_memory

If true, strings are strdup'd and freed on cleanup.

Definition at line 272 of file builder.h.

Referenced by options_registry_find_by_name(), options_registry_find_by_short(), options_struct_destroy(), and registry_entry_to_descriptor().

◆ parse_fn

bool(* option_descriptor_t::parse_fn) (const char *arg, void *dest, char **error_msg)

◆ required

◆ short_name

◆ type

◆ validate

bool(* option_descriptor_t::validate) (const void *options_struct, char **error_msg)

The documentation for this struct was generated from the following file: