feature: cli framework

This commit is contained in:
2025-10-27 11:55:32 +08:00
parent 2ab091d939
commit f7167576cd
8 changed files with 904 additions and 1 deletions

32
src/lib/ccCLI/index.ts Normal file
View File

@@ -0,0 +1,32 @@
/**
* CC:Tweaked CLI Framework
*
* A functional-style CLI framework for CC:Tweaked and TSTL.
* This framework provides a declarative way to define command-line interfaces with support
* for nested commands, arguments, options, and Result-based error handling.
*/
// --- Core public API ---
export { createCli } from "./cli";
// --- Type definitions for creating commands ---
export type {
Command,
Argument,
Option,
ActionContext,
CliError,
UnknownCommandError,
MissingArgumentError,
MissingOptionError,
NoActionError,
} from "./types";
// --- Utility functions for help generation and advanced parsing ---
export { generateHelp, generateCommandList, shouldShowHelp } from "./help";
export {
parseArguments,
validateRequiredArgs,
validateRequiredOptions,
normalizeOptions,
} from "./parser";