Core crun CLI interfaces.
More...
#include <cjson/cJSON.h>
#include <stdio.h>
#include <unistd.h>
Go to the source code of this file.
|
| void | crun () |
| | Main CLI flow entrypoint.
|
| void | crun_version () |
| | Print app version.
|
| void | crun_help () |
| | Print command-line usage/help.
|
| int | crun_update () |
| | Refresh local stacks metadata from remote source.
|
| void | crun_stacks_json_checker (const char *) |
| | Ensure stacks metadata file exists locally.
|
| void | get_user_choice (int *, const char *, const int) |
| | Prompt for menu choice with validation.
|
| const char * | download_crun_package (const struct CrunPackage *) |
| | Resolve package archive from cache or download it.
|
| char * | get_language_buffer (cJSON *) |
| | Build selectable language menu buffer from JSON root.
|
| char * | get_packages_buffer (cJSON *, const char *) |
| | Build selectable package menu buffer for one language.
|
| void | free_all (void **, const size_t) |
| | Release language/package maps and additional owned pointers.
|
Core crun CLI interfaces.
- Author
- ZouariOmar (zouar.nosp@m.ioma.nosp@m.r20@g.nosp@m.mail.nosp@m..com)
- Version
- 0.3
- Date
- 2026-03-18
- Copyright
- Copyright (c) 2025
crun.h
◆ __get_current_dir
| #define __get_current_dir getcwd |
◆ __get_pid
◆ crun()
Main CLI flow entrypoint.
◆ crun_help()
Print command-line usage/help.
◆ crun_stacks_json_checker()
| void crun_stacks_json_checker |
( |
const char * | crun_stacks_json_file_path | ) |
|
Ensure stacks metadata file exists locally.
- Parameters
-
| crun_stacks_json_file_path | Absolute path to local metadata file. |
◆ crun_update()
Refresh local stacks metadata from remote source.
- Returns
- int EXIT_SUCCESS on success, EXIT_FAILURE otherwise.
◆ crun_version()
◆ download_crun_package()
| const char * download_crun_package |
( |
const struct CrunPackage * | crun_package_map | ) |
|
Resolve package archive from cache or download it.
- Parameters
-
| crun_package_map | Selected package metadata. |
- Returns
- const char* Allocated absolute path to package archive, or NULL on failure.
◆ free_all()
| void free_all |
( |
void ** | ptrs, |
|
|
const size_t | len ) |
Release language/package maps and additional owned pointers.
- Parameters
-
| ptrs | Extra pointers to free. |
| len | Number of pointers in ptrs. |
◆ get_language_buffer()
| char * get_language_buffer |
( |
cJSON * | root | ) |
|
Build selectable language menu buffer from JSON root.
- Parameters
-
- Returns
- char* Allocated menu text buffer, or NULL on failure.
◆ get_packages_buffer()
| char * get_packages_buffer |
( |
cJSON * | root, |
|
|
const char * | language_name ) |
Build selectable package menu buffer for one language.
- Parameters
-
| root | Parsed JSON root. |
| language_name | Selected language key. |
- Returns
- char* Allocated menu text buffer, or NULL on failure.
◆ get_user_choice()
| void get_user_choice |
( |
int * | user_choice, |
|
|
const char * | menu, |
|
|
const int | limiter ) |
Prompt for menu choice with validation.
- Parameters
-
| user_choice | Output selected value. |
| menu | Rendered menu text. |
| limiter | Upper bound (exclusive), usually map length. |