33 const char*
const parts[] = {
37 " --config SITE.conf --series URL [--chapters N] [--from CHAP]\n"
38 " [--update] [--out DIR] [--cache-dir DIR] [--format FMT] [--separate] [--seed S]\n"
40 " Formats: cbz|cbt|cbt.gz|epub|jof|rabook\n"
41 " Default: N chapters combine into ONE <slug>-<lo>-<hi>.<ext>.\n"
42 " --separate keeps one archive per chapter.\n"
43 " --from CHAP starts at chapter NUMBERED CHAP (not an index).\n"
44 " --update fetches only incomplete chapters.\n\n"
48 " --config SITE.conf --search TERM [--pick N ...opts]\n"
49 " Lists title + series URL per hit.\n"
50 " --pick N downloads hit N directly using --series options.\n\n"
54 " --config SITE.conf --browse [--pick N ...opts]\n"
55 " Lists site's latest updates (requires browse_url in conf).\n\n"
59 " --list | --update-all --config SITE.conf | --remove URL|SLUG [--out DIR]\n\n",
84 const char*
const parts[] = {
89 " Verify existing downloaded archives/files.\n\n"
94 " Generate starter .conf site descriptor template.\n\n"
98 " --pack DIR --format FMT\n"
99 " Package an existing folder of page images (no network).\n\n"
100 " direct artifact:\n"
103 " https://HOST/PATH/BOOK.cbz [--out DIR] [network options]\n"
104 " Downloads to staging and publishes only after structural\n"
105 " verification. Verified formats: cbz|cbt|cbt.gz|epub|jof|rabook.\n\n"
109 " URL [--out DIR] [--max N] [--attr data-src|src] [--seed S]\n"
110 " [--timeout MS]\n\n",
135 " identity / politeness / network options:\n"
136 " --contact <email|url> Identify yourself in the User-Agent\n"
137 " --polite Raise delays; per-host concurrency 1\n"
138 " --progress Terminal progress bar during downloads\n"
139 " --cache-dir <DIR> Per-host cache root (default: OUT/.mdl_cache)\n"
140 " --refetch Force cache revalidation\n"
141 " --proxy <URL> HTTP/HTTPS proxy (requires --allow-private)\n"
142 " --socks5 <URL> SOCKS5 proxy (requires --allow-private)\n"
143 " --cookie-file <FILE> Cookie file path for libcurl\n"
144 " --ca-file <FILE> Custom PEM CA bundle (verification stays on)\n"
145 " --max-bytes N Per-response size cap (default 64 MiB)\n"
146 " --ignore-robots Do NOT honour robots.txt (logged loudly)\n"
147 " --allow-private Permit loopback/private/link-local peers\n"
148 " --cross-host Permit redirects to a different host\n"
149 " --allow-incomplete Package run with failed pages; archive\n"
150 " is named .INCOMPLETE so it is visibly partial\n");
155 if ((diagnostic ==
nullptr) || (a0 ==
nullptr)) {
158 const char*
const heading[] = {
"usage:\n ", a0,
" --help | --version\n\n"};
Command-line parsing for the mdl CLI.
Private byte-stream helpers shared by mdl CLI units.
ra8_err_t priv_mdl_cli_put_parts(ra8_io_stream_t *stream, const char *const *parts, size_t count)
Write a bounded ordered vector of NUL-terminated text fragments.
static ra8_err_t internal_cli_usage_actions(ra8_io_stream_t *diagnostic, const char *a0)
Write verify, init, pack, artifact, and direct-page help sections.
static ra8_err_t internal_cli_usage_network_options(ra8_io_stream_t *diagnostic)
Write the identity, politeness, and network CLI options.
static ra8_err_t internal_cli_usage_discovery(ra8_io_stream_t *diagnostic, const char *a0)
Write series, discovery, and library help sections.
ra8_err_t mdl_cli_usage(ra8_io_stream_t *diagnostic, const char *a0)
Write the complete usage block to an injected byte stream.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_err_t ra8_io_stream_puts(ra8_io_stream_t *s, const char *str)
Write a NUL-terminated string (without the NUL) to the bound sink.
Caller-allocated byte-stream handle binding a sink to its context.