CLI ForgeCLI Forge
DocsExamplesAPIPlayground
⌘K
GitHub
Home
Arguments OfBasic CLIBundlingCircular Config DetectionComposable BuildersComposable OptionsConfiguration FilesConflicts and ImplicationsDefault ValuesDependency Injection - Logger with Log LevelDependency Injection with ProvidersEnvironment Variable OptionsExecution LifecycleFramework ComparisonGenerated SDKi18next IntegrationInteractive SubshellLocalization SupportMiddlewareMiddleware CompositionMulti-Command CLI StructureNon-Strict Mode (Default)Object Arguments (Simple)Object Arguments with Defaults and ValidationOneOf OptionOption ChoicesOption GroupsOrchestrated WorkflowParser OnlyPrompting for Missing ValuesShell CompletionStrict ModeUsing the Test HarnessZod MiddlewareZod Schema Validation
Changelog
Examples/Parser Only

Parser Only

This example demonstrates how to use @cli-forge/parser to interpret CLI arguments without the need for a CLI framework. For single-command CLIs, this may be enough.

1 FILESTry in Playground

All Example Files

FILE EXPLORER
parser-only.ts
1import { parser } from '@cli-forge/parser';
2
3const argv = parser()
4  .option('name', {
5    type: 'string',
6    description: 'The name to say hello to',
7    default: 'World',
8  })
9  .parse(process.argv.slice(2));
10
11console.log(`Hello, ${argv.name}!`);
12