ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
actions.c File Reference

Browser replacements for native command-line actions. More...

Go to the source code of this file.

Functions

void action_completions (const char *, const char *)
 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 *)
 Create default configuration file and exit.
void action_create_manpage (const char *)
 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).
option_action_fn options_action_callback (const char *name, bool immediate)

Detailed Description

Browser replacements for native command-line actions.

Definition in file wasm/stubs/actions.c.

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 47 of file wasm/stubs/actions.c.

47 {
48 // No-op - update checking not supported in WASM
49}

◆ 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 51 of file wasm/stubs/actions.c.

51 {
52 // No-op - update checking not supported in WASM
53}

◆ 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 11 of file wasm/stubs/actions.c.

11 {
12 // No-op - shell completions not supported in WASM
13}

◆ 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 27 of file wasm/stubs/actions.c.

27 {
28 // No-op - config file creation not supported in WASM
29}

◆ 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 31 of file wasm/stubs/actions.c.

31 {
32 // No-op - man page creation not supported in WASM
33}

◆ 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 19 of file wasm/stubs/actions.c.

19 {
20 // No-op - microphone listing not supported in the browser
21}

◆ 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 23 of file wasm/stubs/actions.c.

23 {
24 // No-op - speaker listing not supported in the browser
25}

◆ 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 15 of file wasm/stubs/actions.c.

15 {
16 // No-op - webcam listing not supported in the browser
17}

◆ 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 39 of file wasm/stubs/actions.c.

39 {
40 // No-op - capabilities not shown in WASM
41}

◆ 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 43 of file wasm/stubs/actions.c.

43 {
44 // No-op - capabilities not shown in WASM
45}

◆ 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 35 of file wasm/stubs/actions.c.

35 {
36 // No-op - no deferred actions in the browser
37}

◆ options_action_callback()

option_action_fn options_action_callback ( const char * name,
bool immediate )

Definition at line 55 of file wasm/stubs/actions.c.

55 {
56 static const struct {
57 const char *name;
58 option_action_fn callback;
59 option_action_fn early_callback;
60 } actions[] = {
64 };
65 if (!name)
66 return NULL;
67 for (size_t i = 0; i < sizeof(actions) / sizeof(actions[0]); ++i) {
68 if (strcmp(name, actions[i].name) == 0)
69 return immediate ? actions[i].early_callback : actions[i].callback;
70 }
71 return NULL;
72}
void(* option_action_fn)(void)
Definition actions.h:234
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().