ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
actions.c File Reference

Go to the source code of this file.

Functions

void action_completions (const char *shell_name, const char *output_path)
 Generate shell completions and output to stdout or file.
void action_list_webcams (void)
 List available webcam devices and exit.
void action_list_microphones (void)
 List available microphone devices and exit.
void action_list_speakers (void)
 List available speaker devices and exit.
void action_create_config (const char *path)
 Create default configuration file and exit.
void action_create_manpage (const char *path)
 Generate man page template from options builder.
void actions_execute_deferred (void)
 Execute the deferred action (if any).
void action_show_capabilities (void)
 Show terminal capabilities and exit.
void action_show_capabilities_immediate (void)
 Execute show capabilities immediately (for binary-level execution).
void action_check_update (void)
 Check for updates and display results.
void action_check_update_immediate (void)
 Execute update check immediately (for binary-level execution).
int platform_enable_keepawake (void)
void platform_disable_keepawake (void)
bool keyboard_request_background (void)
bool keyboard_input_available (void)
keyboard_key_t keyboard_read_nonblocking (void)
void keyboard_destroy (void)
option_action_fn options_action_callback (const char *name, bool immediate)

Function Documentation

◆ action_check_update()

void action_check_update ( void )

Check for updates and display results.

Performs update check against GitHub releases API and displays results. Exits with code 0 on success, 1 on error.

Definition at line 53 of file src/web/platform/stubs/actions.c.

53 {
54 // No-op - update checking not supported in WASM
55}

◆ action_check_update_immediate()

void action_check_update_immediate ( void )

Execute update check immediately (for binary-level execution).

Performs immediate update check and exits. Used when –check-update is specified before mode detection. Exits with code 0 on success, 1 on error.

Execute update check immediately (for binary-level execution).

Definition at line 57 of file src/web/platform/stubs/actions.c.

57 {
58 // No-op - update checking not supported in WASM
59}

◆ action_completions()

void action_completions ( const char * shell_name,
const char * output_path )

Generate shell completions and output to stdout or file.

Generates shell completion script for the specified shell (bash, fish, zsh, powershell). Output is dynamically generated from the options registry, ensuring completions are always in sync with current options. Outputs to stdout by default, or to specified file path if provided. Prompts for overwrite confirmation if file already exists. Exits with code 0 on success, 1 on error.

Parameters
shell_nameShell name: "bash", "fish", "zsh", or "powershell"
output_pathOptional file path to write completions to. NULL or empty string = stdout.

Definition at line 13 of file src/web/platform/stubs/actions.c.

13 {
14 (void)shell_name;
15 (void)output_path;
16 // No-op - shell completions not supported in WASM
17}

◆ action_create_config()

void action_create_config ( const char * output_path)

Create default configuration file and exit.

Creates a default configuration file. Outputs to stdout by default, or to specified file path if provided. Prompts for overwrite confirmation if file already exists. Exits with code 0 on success, 1 on error.

Parameters
output_pathOptional file path to write config to. NULL or empty string = stdout.

Definition at line 31 of file src/web/platform/stubs/actions.c.

31 {
32 (void)path;
33 // No-op - config file creation not supported in WASM
34}

◆ action_create_manpage()

void action_create_manpage ( const char * output_path)

Generate man page template from options builder.

Generates a merged man page template preserving manual content. Outputs to stdout by default, or to specified file path if provided. Prompts for overwrite confirmation if file already exists. Exits with code 0 on success, 1 on error.

Parameters
output_pathOptional file path to write man page to. NULL or empty string = stdout.

Definition at line 36 of file src/web/platform/stubs/actions.c.

36 {
37 (void)path;
38 // No-op - man page creation not supported in WASM
39}

◆ action_list_microphones()

void action_list_microphones ( void )

List available microphone devices and exit.

Enumerates all audio input devices and prints them to stdout. Exits with code 0 on success, 1 on error.

Definition at line 23 of file src/web/platform/stubs/actions.c.

23 {
24 // No-op - microphone listing not supported in WASM mirror mode
25}

◆ action_list_speakers()

void action_list_speakers ( void )

List available speaker devices and exit.

Enumerates all audio output devices and prints them to stdout. Exits with code 0 on success, 1 on error.

Definition at line 27 of file src/web/platform/stubs/actions.c.

27 {
28 // No-op - speaker listing not supported in WASM mirror mode
29}

◆ action_list_webcams()

void action_list_webcams ( void )

List available webcam devices and exit.

Enumerates all webcam devices and prints them to stdout. Exits with code 0 on success, 1 on error.

Definition at line 19 of file src/web/platform/stubs/actions.c.

19 {
20 // No-op - webcam listing not supported in WASM mirror mode
21}

◆ action_show_capabilities()

void action_show_capabilities ( void )

Show terminal capabilities and exit.

Detects and displays terminal color support, UTF-8 support, dimensions, and terminal program name. Exits with code 0.

Note: This action is deferred until after all options are parsed and dimensions are calculated, so that –width and –height flags are properly reflected in the output.

Definition at line 45 of file src/web/platform/stubs/actions.c.

45 {
46 // No-op - capabilities not shown in WASM
47}

◆ action_show_capabilities_immediate()

void action_show_capabilities_immediate ( void )

Execute show capabilities immediately (for binary-level execution).

Shows terminal capabilities before full options parsing. Uses detected terminal size (doesn't respect –width/–height). Exits with code 0.

Execute show capabilities immediately (for binary-level execution).

Definition at line 49 of file src/web/platform/stubs/actions.c.

49 {
50 // No-op - capabilities not shown in WASM
51}

◆ actions_execute_deferred()

void actions_execute_deferred ( void )

Execute the deferred action (if any).

This function should be called during STAGE 8 of options_init() after all options are fully parsed and dimensions are calculated.

Definition at line 41 of file src/web/platform/stubs/actions.c.

41 {
42 // No-op - no deferred actions in WASM mirror mode
43}

◆ keyboard_destroy()

void keyboard_destroy ( void )

Definition at line 85 of file src/web/platform/stubs/actions.c.

85 {
86 // No-op - no keyboard to destroy in WASM
87}

Referenced by asciichat_shared_destroy(), stats_runtime_start(), stats_runtime_stop(), ui_sync_start(), and ui_sync_stop().

◆ keyboard_input_available()

bool keyboard_input_available ( void )

Definition at line 77 of file src/web/platform/stubs/actions.c.

77 {
78 return false;
79}

◆ keyboard_read_nonblocking()

keyboard_key_t keyboard_read_nonblocking ( void )

Definition at line 81 of file src/web/platform/stubs/actions.c.

81 {
82 return KEY_NONE; // No input available in WASM
83}

◆ keyboard_request_background()

bool keyboard_request_background ( void )

Definition at line 73 of file src/web/platform/stubs/actions.c.

73 {
74 return false;
75}

◆ options_action_callback()

option_action_fn options_action_callback ( const char * name,
bool immediate )

Definition at line 89 of file src/web/platform/stubs/actions.c.

89 {
90 static const struct {
91 const char *name;
92 option_action_fn callback;
93 option_action_fn early_callback;
94 } actions[] = {
98 };
99 if (!name)
100 return NULL;
101 for (size_t i = 0; i < sizeof(actions) / sizeof(actions[0]); ++i) {
102 if (strcmp(name, actions[i].name) == 0)
103 return immediate ? actions[i].early_callback : actions[i].callback;
104 }
105 return NULL;
106}
void(* option_action_fn)(void)
Definition actions.h:228
void action_check_update_immediate(void)
Execute update check immediately (for early binary-level execution).
void action_check_update(void)
Check for updates and display results.
void action_show_capabilities(void)
Show terminal capabilities and exit.
void action_list_microphones(void)
List available microphone devices and exit.
void action_list_webcams(void)
List available webcam devices and exit.
void action_list_speakers(void)
List available speaker devices and exit.
void action_show_capabilities_immediate(void)
Execute show capabilities immediately (for early binary-level execution).

References action_check_update(), action_check_update_immediate(), action_list_microphones(), action_list_speakers(), action_list_webcams(), action_show_capabilities(), and action_show_capabilities_immediate().

◆ platform_disable_keepawake()

void platform_disable_keepawake ( void )

Definition at line 66 of file src/web/platform/stubs/actions.c.

66 {
67 // No-op in browser
68}

Referenced by session_server_like_run().

◆ platform_enable_keepawake()

int platform_enable_keepawake ( void )

Definition at line 62 of file src/web/platform/stubs/actions.c.

62 {
63 return ASCIICHAT_OK; // No-op in browser (browser manages power)
64}
@ ASCIICHAT_OK
Definition error_codes.h:50

References ASCIICHAT_OK.

Referenced by session_server_like_run().