ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
presets.h File Reference

Preset option configurations for ascii-chat modes. More...

Go to the source code of this file.

Functions

options_config_t * options_preset_unified (const char *program_name, const char *description)
 Build unified options config with ALL options (binary + all modes).

Detailed Description

Preset option configurations for ascii-chat modes.

Definition in file presets.h.

Function Documentation

◆ options_preset_unified()

options_config_t * options_preset_unified ( const char * program_name,
const char * description )

Build unified options config with ALL options (binary + all modes).

This is the single source of truth for all options. Each option has a mode_bitmask indicating which modes it applies to. The config includes all options, and validation happens after parsing based on detected mode.

Get binary-level options preset.

This is the single source of truth for all options. Each option has a mode_bitmask indicating which modes it applies to. The config includes all options, and validation happens after parsing based on detected mode.

Definition at line 58 of file presets.c.

58 {
60 if (!b) {
61 SET_ERRNO(ERROR_MEMORY, "Failed to create options builder");
62 return NULL;
63 }
64
65 b->program_name = program_name ? program_name : "ascii-chat";
66 b->description = description ? description : "Video chat in your terminal";
67
68 // Add ALL options from registry (binary + all modes)
70 if (err != ASCIICHAT_OK) {
72 SET_ERRNO(err, "Failed to add all options to builder");
73 return NULL;
74 }
75
76 // Add positional arguments for each mode
77 // These allow parsing of positional arguments like "192.168.1.1" for client mode
78 // and "[bind-address]" for server mode
79
80 // Generate random session strings for examples
81 // Use static buffers so they persist after the function returns
82 static char session_buf1[SESSION_STRING_BUFFER_SIZE];
83 static char session_buf2[SESSION_STRING_BUFFER_SIZE];
84 static char session_buf3[SESSION_STRING_BUFFER_SIZE];
85 static char session_buf4[SESSION_STRING_BUFFER_SIZE];
86 static char session_buf5[SESSION_STRING_BUFFER_SIZE];
87 static char session_buf6[SESSION_STRING_BUFFER_SIZE];
88 static char session_buf7[SESSION_STRING_BUFFER_SIZE];
89 static char session_buf8[SESSION_STRING_BUFFER_SIZE];
90 static char session_buf9[SESSION_STRING_BUFFER_SIZE];
91 static char session_buf10[SESSION_STRING_BUFFER_SIZE];
92
93 // Fallback strings if generation fails
94 char *example_session_string1 = "adjective-noun-noun";
95 char *example_session_string2 = "adjective-noun-noun";
96 char *example_session_string3 = "adjective-noun-noun";
97 char *example_session_string4 = "adjective-noun-noun";
98 char *example_session_string5 = "adjective-noun-noun";
99 char *example_session_string6 = "adjective-noun-noun";
100 char *example_session_string7 = "adjective-noun-noun";
101 char *example_session_string8 = "adjective-noun-noun";
102 char *example_session_string9 = "adjective-noun-noun";
103 char *example_session_string10 = "adjective-noun-noun";
104
105 // Generate session strings for examples (sodium_init called as needed by acds_string_generate)
106 acds_string_generate(session_buf1, sizeof(session_buf1));
107 if (session_buf1[0] != '\0') {
108 example_session_string1 = session_buf1;
109 }
110 acds_string_generate(session_buf2, sizeof(session_buf2));
111 if (session_buf2[0] != '\0') {
112 example_session_string2 = session_buf2;
113 }
114 acds_string_generate(session_buf3, sizeof(session_buf3));
115 if (session_buf3[0] != '\0') {
116 example_session_string3 = session_buf3;
117 }
118 acds_string_generate(session_buf4, sizeof(session_buf4));
119 if (session_buf4[0] != '\0') {
120 example_session_string4 = session_buf4;
121 }
122 acds_string_generate(session_buf5, sizeof(session_buf5));
123 if (session_buf5[0] != '\0') {
124 example_session_string5 = session_buf5;
125 }
126 acds_string_generate(session_buf6, sizeof(session_buf6));
127 if (session_buf6[0] != '\0') {
128 example_session_string6 = session_buf6;
129 }
130 acds_string_generate(session_buf7, sizeof(session_buf7));
131 if (session_buf7[0] != '\0') {
132 example_session_string7 = session_buf7;
133 }
134 acds_string_generate(session_buf8, sizeof(session_buf8));
135 if (session_buf8[0] != '\0') {
136 example_session_string8 = session_buf8;
137 }
138 acds_string_generate(session_buf9, sizeof(session_buf9));
139 if (session_buf9[0] != '\0') {
140 example_session_string9 = session_buf9;
141 }
142 acds_string_generate(session_buf10, sizeof(session_buf10));
143 if (session_buf10[0] != '\0') {
144 example_session_string10 = session_buf10;
145 }
146
147 // Build session string examples dynamically for discovery mode
148 // These appear at the beginning of the examples section, right after "start new session"
149 static char example_buf1[SESSION_STRING_BUFFER_SIZE];
150 static char example_buf2[SESSION_STRING_BUFFER_SIZE];
151 static char example_buf3[SESSION_STRING_BUFFER_SIZE];
152 static char example_buf4[SESSION_STRING_BUFFER_SIZE];
153 static char example_buf5[SESSION_STRING_BUFFER_SIZE];
154 static char example_buf6[SESSION_STRING_BUFFER_SIZE];
155 static char example_buf7[SESSION_STRING_BUFFER_SIZE];
156 static char example_buf8[SESSION_STRING_BUFFER_SIZE];
157 static char example_buf9[SESSION_STRING_BUFFER_SIZE];
158 static char example_buf10[SESSION_STRING_BUFFER_SIZE];
159
160 safe_snprintf(example_buf1, sizeof(example_buf1), "%s", example_session_string1);
161 safe_snprintf(example_buf2, sizeof(example_buf2), "%s", example_session_string2);
162 safe_snprintf(example_buf3, sizeof(example_buf3), "%s", example_session_string3);
163 safe_snprintf(example_buf4, sizeof(example_buf4), "%s", example_session_string4);
164 safe_snprintf(example_buf5, sizeof(example_buf5), "%s", example_session_string5);
165 safe_snprintf(example_buf6, sizeof(example_buf6), "%s", example_session_string6);
166 safe_snprintf(example_buf7, sizeof(example_buf7), "%s", example_session_string7);
167 safe_snprintf(example_buf8, sizeof(example_buf8), "%s", example_session_string8);
168 safe_snprintf(example_buf9, sizeof(example_buf9), "%s", example_session_string9);
169 safe_snprintf(example_buf10, sizeof(example_buf10), "%s", example_session_string10);
170
171 // Client mode: [address] - can be IP, hostname, hostname:port, or WebSocket URL
172 static const char *client_examples[] = {"localhost",
173 "ascii-chat.com",
174 "0.0.0.0",
175 "::",
176 "192.168.1.1:8080",
177 "[2001:db8::42]:27224",
178 "233.27.48.203:27224",
179 "62fb:759e:2bce:21d7:9e5d:13f8:3c11:5084:27224",
180 "ws://example.com:8080",
181 "wss://secure.example.com:443"};
182 // Discovery mode: [session-string] - session string or empty to start new session
183 // Use simple static examples for positional arguments section (dynamic strings shown in examples section)
184 static const char *discovery_examples[] = {
185 "(empty/unset) start new session. generates a session string to give someone to connect to you.",
186 (const char *)example_buf7, (const char *)example_buf8, (const char *)example_buf9, (const char *)example_buf10};
188 b, "session-string", "(optional) Random three words in format adjective-noun-noun that connect you to a call.",
189 false, "POSITIONAL ARGUMENTS", discovery_examples, ARRAY_SIZE(discovery_examples), OPTION_MODE_DISCOVERY,
191
192 // Server and Discovery Service modes: [bind-address] [bind-address] - can be IP or hostname, up to 2 for IPv4/IPv6
193 static const char *server_examples[] = {"localhost",
194 "ascii-chat.com",
195 "0.0.0.0",
196 "::",
197 "234.50.188.236",
198 "9631:54e7:5b5c:80dc:0f62:1f01:7ccf:5512",
199 "105.137.19.11 3a08:7276:ccb4:7b31:e934:5330:9b3a:9598",
200 "::1 192.168.1.100"};
202 b, "bind-address", "(optional) 0-2 addresses for a server to bind to, one IPv4 and the other IPv6.", false,
203 "POSITIONAL ARGUMENTS", server_examples, ARRAY_SIZE(server_examples),
205
206 options_builder_add_positional(b, "address", "(optional) Server address for client to connect to.", false,
207 "POSITIONAL ARGUMENTS", client_examples, ARRAY_SIZE(client_examples),
209
210 // Mirror mode: [file|url] - file path or URL to stream
211 static const char *mirror_media_examples[] = {"/path/to/video.mp4", "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
212 "https://example.com/stream.m3u8"};
213 options_builder_add_positional(b, "file|url",
214 "(optional) Media file path or URL to stream. If omitted, uses webcam. "
215 "Cannot be combined with --file or --url.",
216 false, "POSITIONAL ARGUMENTS", mirror_media_examples,
217 ARRAY_SIZE(mirror_media_examples), OPTION_MODE_MIRROR, parse_mirror_media);
218
219 // Add usage lines for all modes
220 options_builder_add_usage(b, NULL, NULL, true, "Start a new session (share the session string)");
221 options_builder_add_usage(b, NULL, "<session-string>", true, "Join an existing session");
222 options_builder_add_usage(b, NULL, "<mode>", true, "Run in a specific mode");
223 options_builder_add_usage(b, "mcp-server", "[--transport http|stdio] [--server] [bind-address] [bind-address]", true,
224 "MCP rendering tools (stdio locally, HTTP with --transport http, default port 27228)");
225 options_builder_add_example(b, OPTION_MODE_MCP_SERVER, "", "Local MCP tools over stdio", false);
226 options_builder_add_example(b, OPTION_MODE_MCP_SERVER, "--transport http --address 127.0.0.1 --port 27228",
227 "Local MCP tools over Streamable HTTP", false);
228 options_builder_add_usage(b, "server", "[bind-address] [bind-address]", true,
229 "Start server (can specify 0-2 bind addresses, one IPv4 and the other IPv6)");
230 options_builder_add_usage(b, "client", "[address]", true, "Connect to server (defaults to localhost:27224)");
231 options_builder_add_usage(b, "mirror", "[file|url]", true, "View local webcam or media file or URL as ASCII art");
232 options_builder_add_usage(b, "discovery-service", "[bind-address] [bind-address]", true,
233 "Start discovery service (can specify 0-2 bind addresses, one IPv4 and the other IPv6)");
234 options_builder_add_usage(b, NULL, "[mode] --help", false, "Show help for a specific mode");
235
236 // Add examples for binary-level help and discovery mode
237 options_builder_add_example(b, OPTION_MODE_BINARY, NULL, "Start new session (share the session string)", false);
238 options_builder_add_example(b, OPTION_MODE_BINARY, example_buf1, "Join a session using the session string", true);
239
240 // Build combined examples with session string + flags
241 static char combined_buf1[OPTIONS_CONFIG_PRESETS_COMBINED_BUF1_BUFFER_SIZE];
242 static char combined_buf2[OPTIONS_CONFIG_PRESETS_COMBINED_BUF2_BUFFER_SIZE];
243 static char combined_buf3[OPTIONS_CONFIG_PRESETS_COMBINED_BUF3_BUFFER_SIZE];
244 static char combined_buf4[OPTIONS_CONFIG_PRESETS_COMBINED_BUF4_BUFFER_SIZE];
245 static char combined_buf5[OPTIONS_CONFIG_PRESETS_COMBINED_BUF5_BUFFER_SIZE];
246 safe_snprintf(combined_buf1, sizeof(combined_buf1), "%s --file video.mp4", example_buf3);
247 safe_snprintf(combined_buf2, sizeof(combined_buf2), "%s --url 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'",
248 example_buf4);
249 safe_snprintf(combined_buf3, sizeof(combined_buf3), "%s -f -", example_buf5);
250 safe_snprintf(combined_buf4, sizeof(combined_buf4), "%s --palette-chars '@%%#*+=-:. '", example_buf6);
251 safe_snprintf(combined_buf5, sizeof(combined_buf5), "%s --discovery-service --discovery-service-port 27225",
252 example_buf2);
253
254 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf1, "Join session and stream from local video file",
255 false);
256 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf2, "Join session and stream from YouTube video",
257 false);
258 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf3, "Join session and stream media from stdin", false);
259 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf4, "Join session with custom ASCII palette characters",
260 false);
261 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf5, "Join session via custom discovery server", false);
262
263 // Add examples for server-like modes (server + discovery-service)
264 options_builder_add_example(b, OPTION_MODE_SERVER_LIKE, NULL, "Start on localhost (127.0.0.1 and ::1)", false);
265 options_builder_add_example(b, OPTION_MODE_SERVER_LIKE, "0.0.0.0", "Start on all IPv4 interfaces", false);
267 "0.0.0.0 ::", "Start on all IPv4 and IPv6 interfaces (dual-stack)", false);
268 options_builder_add_example(b, OPTION_MODE_SERVER_LIKE, "--port 8080", "Start on custom port", false);
269
270 // Server-specific examples
271 options_builder_add_example(b, OPTION_MODE_SERVER, "--key ~/.ssh/id_ed25519 --discovery",
272 "Start with identity key and discovery registration", false);
273
274 // Add examples for client-like modes (client + mirror)
275 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--url 'https://youtu.be/7ynHVGCehoM'",
276 "Stream from YouTube URL (also supports RTSP, HTTP, and HTTPS URLs)", false);
277 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--url 'https://www.twitch.tv/ludwig'",
278 "Stream Ludwig from videogames on Twitch", false);
279 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "-f video.mp4", "Stream from local video file", false);
280 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--palette-chars '@%#*+=-:. '",
281 "Custom palette characters to use. UTF-8 is allowed.", false);
283 b, OPTION_MODE_CLIENT_LIKE, "--snapshot",
284 "Print ascii art for --snapshot-delay's value of seconds then print the last frame and exit. "
285 "In snapshot mode, --width, --height, and --color are NOT autodetected when piping stdin in or redirecting "
286 "output.",
287 false);
288 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--color-filter cyan --palette cool",
289 "Apply cyan color filter and cool palette", false);
290
291 // Client-specific examples
292 options_builder_add_example(b, OPTION_MODE_CLIENT, "example.com", "Connect to remote server", false);
293 options_builder_add_example(b, OPTION_MODE_CLIENT, "example.com:8080", "Connect to remote server on custom port",
294 false);
295 options_builder_add_example(b, OPTION_MODE_CLIENT, "--color-mode mono --render-mode half-block --width 120",
296 "Connect with custom display options", false);
297
298 // Mirror-specific examples (unique to mirror mode)
300 b, OPTION_MODE_MIRROR, NULL,
301 "View the webcam or files or URLs as ASCII art. Like client mode but without network connectivity or a server.",
302 false);
303 options_builder_add_example(b, OPTION_MODE_MIRROR, "--color-mode mono", "View webcam in black and white", false);
304 options_builder_add_example(b, OPTION_MODE_MIRROR, "--color-filter green",
305 "View webcam with green monochromatic color filter", false);
306 options_builder_add_example(b, OPTION_MODE_MIRROR, "--matrix --color-filter rainbow",
307 "Matrix rain effect with rainbow colors cycling over 3.5s", false);
309 "Stream media from stdin (cat file.gif | ascii-chat mirror -f '-')", false);
310 options_builder_add_example_utility(b, OPTION_MODE_MIRROR, "cat video.avi | ascii-chat mirror -f '-' -l -s 00:30",
311 "Stream .avi from stdin, looped, seeking to 00:30", true);
312 options_builder_add_example(b, OPTION_MODE_MIRROR, "--file video.mov --seek 22:10",
313 "Start playback at exactly 22:10 (also works with --url)", false);
314 options_builder_add_example(b, OPTION_MODE_MIRROR, "-f 'https://youtu.be/LS9W8SO-Two' -S -D 0 -s 5:12",
315 "Print a single frame from a YouTube video at exactly 5:12 and exit", false);
316 options_builder_add_example(b, OPTION_MODE_MIRROR, "-S -D 0 | tee frame.txt | pbcopy",
317 "Capture single ASCII frame to clipboard (macOS) and file", false);
319 "View ASCII frame from clipboard (macOS)", true);
320
321 // Discovery-service specific examples
322 options_builder_add_example(b, OPTION_MODE_DISCOVERY_SVC, "--require-server-identity --require-client-identity",
323 "Enforce identity verification for all parties", false);
324
325 // Add mode descriptions
327 b, "default",
328 "When the ascii-chat binary is used without a mode, it operates as either client or server automatically and "
329 "uses the discovery-service to make peer connections with session strings");
330 options_builder_add_mode(b, "server", "Run as multi-client video chat server");
331 options_builder_add_mode(b, "client", "Run as video chat client (connect to server)");
332 options_builder_add_mode(b, "mirror", "View local media as ASCII art (no server)");
333 options_builder_add_mode(b, "discovery-service", "Secure P2P session signalling");
334 options_builder_add_mode(b, "mcp-server", "MCP media rendering tools");
335 options_builder_add_mode(b, "api-server", "HTTP image-to-ASCII API");
336
337 // Add custom help sections for interactive modes (client, mirror, and discovery)
338 options_builder_add_custom_section(b, "KEYBINDINGS",
339 "Available in ascii-chat client, mirror, and discovery modes. "
340 "While rendering, press '?' to display a keyboard shortcuts help menu showing:\n"
341 " - Available keybindings (?, Space, arrows, m, c, f, r, -)\n"
342 " - Press - to toggle the FPS counter (always visible in keyboard help).\n"
343 " - Current settings (volume, color mode, audio status, etc.)",
345
346 // Add environment variables section (all modes)
348 b, "ENVIRONMENT",
349 "All command-line flags that accept values have corresponding environment variables.\n"
350 " Format: ASCII_CHAT_<FLAG_NAME> where FLAG_NAME is uppercase with hyphens replaced by underscores\n"
351 " Example: --color-filter maps to ASCII_CHAT_COLOR_FILTER\n"
352 "\n"
353 " Configuration precedence (lowest to highest):\n"
354 " 1. Config file values (~/.ascii-chat/config.toml)\n"
355 " 2. Environment variables (ASCII_CHAT_*)\n"
356 " 3. Command-line flags (--flag-name)\n"
357 "\n"
358 " Additional environment variables are documented in the ascii-chat(1) man page.",
360
361 // Add common dependencies (these will be validated after parsing)
362 // Note: Dependencies are validated at runtime, so we add them here for documentation
363
364 // ============================================================================
365 // Media Source Conflicts
366 // ============================================================================
367 // URL conflicts: --url cannot be used with --file or --loop
369 "Option --url cannot be used with --file (--url takes priority)");
371 b, "url", "loop", "Option --url cannot be used with --loop (network streams cannot be looped)");
372
373 // ============================================================================
374 // Encryption & Authentication Conflicts
375 // ============================================================================
376 // Reject contradictory CLI requests before initializing transport security.
377 options_builder_add_dependency_conflicts(b, "no-encrypt", "encrypt", "Cannot use --no-encrypt with --encrypt");
378
379 // Authentication material conflicts with explicitly disabling authentication.
381 "Cannot use --no-auth with --key (key requires authentication)");
382 options_builder_add_dependency_conflicts(b, "no-auth", "password",
383 "Cannot use --no-auth with --password (password requires authentication)");
385 b, "no-auth", "client-keys", "Cannot use --no-auth with --client-keys (key list requires authentication)");
387 b, "no-auth", "server-key", "Cannot use --no-auth with --server-key (verification requires authentication)");
388
389 // Identity and verification keys can be combined, including with --no-encrypt.
390
391 // ============================================================================
392 // Compression Conflicts
393 // ============================================================================
394 // Cannot use --no-compress with --compression-level
395 options_builder_add_dependency_conflicts(b, "no-compress", "compression-level",
396 "Cannot use --no-compress with --compression-level");
397
398 // ============================================================================
399 // Audio Encoding Conflicts
400 // ============================================================================
401 // Cannot use both --encode-audio and --no-encode-audio
402 options_builder_add_dependency_conflicts(b, "encode-audio", "no-encode-audio",
403 "Cannot use both --encode-audio and --no-encode-audio");
404
405 // ============================================================================
406 // Display & Screen Conflicts
407 // ============================================================================
408 options_builder_add_dependency_conflicts(b, "waveform", "matrix", "Option --waveform cannot be used with --matrix");
409 options_builder_add_dependency_conflicts(b, "fft", "matrix", "Option --fft cannot be used with --matrix");
410 options_builder_add_dependency_conflicts(b, "waveform", "fft",
411 "Options --waveform and --fft cannot be used together");
412 options_builder_add_dependency_conflicts(b, "waveform", "audio",
413 "Option --waveform requires audio; remove --audio=false");
414 options_builder_add_dependency_conflicts(b, "fft", "audio", "Option --fft requires audio; remove --audio=false");
415 options_builder_add_dependency_conflicts(b, "waveform", "stretch", "Option --waveform cannot be used with --stretch");
416 options_builder_add_dependency_conflicts(b, "fft", "stretch", "Option --fft cannot be used with --stretch");
417
418 // ============================================================================
419 // Requirements (dependencies that must be satisfied)
420 // ============================================================================
421 // --snapshot-delay requires --snapshot
422 options_builder_add_dependency_requires(b, "snapshot-delay", "snapshot",
423 "Option --snapshot-delay requires --snapshot");
424
425 // --loop requires --file (can't loop network streams)
426 options_builder_add_dependency_requires(b, "loop", "file", "Option --loop requires --file");
427
428 const options_config_t *config = options_builder_build(b);
430 return config;
431}
#define SET_ERRNO(code,...)
void options_builder_add_usage(options_builder_t *builder, const char *mode, const char *positional, bool show_options, const char *description)
Add usage line descriptor.
void options_builder_add_example(options_builder_t *builder, uint32_t mode_bitmask, const char *args, const char *description, bool owns_args)
Add example descriptor.
void options_builder_add_dependency_requires(options_builder_t *builder, const char *option_name, const char *depends_on, const char *error_message)
Add dependency: if option_name is set, depends_on must be set.
void options_builder_add_positional(options_builder_t *builder, const char *name, const char *help_text, bool required, const char *section_heading, const char **examples, size_t num_examples, option_mode_bitmask_t mode_bitmask, int(*parse_fn)(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg))
Add positional argument descriptor.
void options_builder_add_dependency_conflicts(options_builder_t *builder, const char *option_name, const char *conflicts_with, const char *error_message)
Add anti-dependency: if option_name is set, conflicts_with must NOT be set.
void options_builder_add_mode(options_builder_t *builder, const char *name, const char *description)
Add mode descriptor.
void options_builder_add_custom_section(options_builder_t *builder, const char *heading, const char *content, option_mode_bitmask_t mode_bitmask)
Add a custom help section.
void options_builder_destroy(options_builder_t *builder)
Free options builder.
options_config_t * options_builder_build(options_builder_t *builder)
Build immutable options config.
void options_builder_add_example_utility(options_builder_t *builder, uint32_t mode_bitmask, const char *args, const char *description, bool is_utility_command)
Add an example with utility command support.
options_builder_t * options_builder_create(size_t struct_size)
Mutable owner used to assemble option descriptors, dependencies, help sections, and examples before b...
asciichat_error_t acds_string_generate(char *output, size_t output_size)
Generate random session string.
#define ARRAY_SIZE(arr)
Calculate the number of elements in an array.
Definition common.h:180
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
@ ERROR_MEMORY
Definition error_codes.h:51
@ ASCIICHAT_OK
Definition error_codes.h:46
#define OPTION_MODE_CLIENT_LIKE
Definition options.h:956
struct options_state options_t
Immutable, RCU-published snapshot of the application's runtime configuration.
#define OPTION_MODE_SERVER_LIKE
Mode group macros for examples.
Definition options.h:955
@ OPTION_MODE_ALL
All modes + binary.
Definition options.h:946
@ OPTION_MODE_BINARY
Binary-level options (parsed before mode detection).
Definition options.h:945
@ OPTION_MODE_CLIENT
Client mode (bit 1).
Definition options.h:939
@ OPTION_MODE_DISCOVERY
Discovery mode (bit 4).
Definition options.h:942
@ OPTION_MODE_SERVER
Server mode (bit 0).
Definition options.h:938
@ OPTION_MODE_MIRROR
Mirror mode (bit 2).
Definition options.h:940
@ OPTION_MODE_MCP_SERVER
Definition options.h:943
@ OPTION_MODE_DISCOVERY_SVC
Discovery server mode (bit 3).
Definition options.h:941
int safe_snprintf(char *buffer, size_t buffer_size, const char *format,...)
Platform-safe snprintf wrapper.
int parse_server_bind_address(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse server bind address positional argument.
Definition parsers.c:514
int parse_mirror_media(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse mirror mode positional argument (file path or URL).
Definition parsers.c:825
int parse_client_address(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse client address positional argument.
Definition parsers.c:636
#define OPTIONS_CONFIG_PRESETS_COMBINED_BUF1_BUFFER_SIZE
Definition presets.c:8
#define OPTIONS_CONFIG_PRESETS_COMBINED_BUF4_BUFFER_SIZE
Definition presets.c:11
#define OPTIONS_CONFIG_PRESETS_COMBINED_BUF2_BUFFER_SIZE
Definition presets.c:9
#define OPTIONS_CONFIG_PRESETS_COMBINED_BUF3_BUFFER_SIZE
Definition presets.c:10
#define OPTIONS_CONFIG_PRESETS_COMBINED_BUF5_BUFFER_SIZE
Definition presets.c:12
asciichat_error_t options_registry_add_all_to_builder(options_builder_t *builder)
Add all options from registry to builder.
Definition public_api.c:20
#define SESSION_STRING_BUFFER_SIZE
Immutable parsing tables produced from an options builder.
Definition builder.h:457
const char * program_name
Definition builder.h:487
const char * description
Definition builder.h:488
Immutable parsing tables produced from an options builder.
Definition builder.h:414

References acds_string_generate(), ARRAY_SIZE, ASCIICHAT_OK, options_builder_t::description, ERROR_MEMORY, OPTION_MODE_ALL, OPTION_MODE_BINARY, OPTION_MODE_CLIENT, OPTION_MODE_CLIENT_LIKE, OPTION_MODE_DISCOVERY, OPTION_MODE_DISCOVERY_SVC, OPTION_MODE_MCP_SERVER, OPTION_MODE_MIRROR, OPTION_MODE_SERVER, OPTION_MODE_SERVER_LIKE, options_builder_add_custom_section(), options_builder_add_dependency_conflicts(), options_builder_add_dependency_requires(), options_builder_add_example(), options_builder_add_example_utility(), options_builder_add_mode(), options_builder_add_positional(), options_builder_add_usage(), options_builder_build(), options_builder_create(), options_builder_destroy(), OPTIONS_CONFIG_PRESETS_COMBINED_BUF1_BUFFER_SIZE, OPTIONS_CONFIG_PRESETS_COMBINED_BUF2_BUFFER_SIZE, OPTIONS_CONFIG_PRESETS_COMBINED_BUF3_BUFFER_SIZE, OPTIONS_CONFIG_PRESETS_COMBINED_BUF4_BUFFER_SIZE, OPTIONS_CONFIG_PRESETS_COMBINED_BUF5_BUFFER_SIZE, options_registry_add_all_to_builder(), parse_client_address(), parse_mirror_media(), parse_server_bind_address(), options_builder_t::program_name, safe_snprintf(), SESSION_STRING_BUFFER_SIZE, and SET_ERRNO.

Referenced by action_create_config(), action_create_manpage(), config_create_default(), options_init(), and usage().