c-md/srcs/cli/help.c.md
2026-01-12 16:22:13 +01:00

1.1 KiB

help.c


Includes

#include <stdio.h>

#include "cli.h"

Function Descriptions

cli_print_help

Prints the help message for the command-line interface.

Parameters

  • progname: Name of the program.

Implementation

void
cli_print_help(const char *progname)
{
	fprintf(stderr, "Usage: %s [OPTIONS]\n\n", progname);
	fprintf(stderr, "Extract code blocks from literate markdown files.\n\n");
	fprintf(stderr, "Options:\n");
	fprintf(stderr, "  -h, --help          Show this help\n");
	fprintf(stderr, "  -e, --ext EXT       Extension to extract (c, h, py, etc.)\n");
	fprintf(stderr, "                      Required for stdin, optional for files\n");
	fprintf(stderr, "  -i, --input FILE    Input file (default: stdin)\n");
	fprintf(stderr, "  -o, --output FILE   Output file (default: stdout)\n");
	fprintf(stderr, "  -m, --map FILE      Generate line mapping file\n\n");
	fprintf(stderr, "Examples:\n");
	fprintf(stderr, "  %s -e c < input.md > output.c\n", progname);
	fprintf(stderr, "  %s -i main.c.md -o main.c\n", progname);
	fprintf(stderr, "  %s -e h -i file.md -o file.h -m file.map\n", progname);
}