Main entry point for the bargs CLI argument parser.
Provides a combinator-style API for building type-safe CLIs.
import { bargs, opt, pos } from '@boneskull/bargs';await bargs('my-app', { version: '1.0.0' }) .globals(opt.options({ verbose: opt.boolean({ aliases: ['v'] }) })) .command( 'greet', pos.positionals(pos.string({ name: 'name', required: true })), ({ positionals }) => console.log(`Hello, ${positionals[0]}!`), 'Say hello', ) .parseAsync(); Copy
import { bargs, opt, pos } from '@boneskull/bargs';await bargs('my-app', { version: '1.0.0' }) .globals(opt.options({ verbose: opt.boolean({ aliases: ['v'] }) })) .command( 'greet', pos.positionals(pos.string({ name: 'name', required: true })), ({ positionals }) => console.log(`Hello, ${positionals[0]}!`), 'Say hello', ) .parseAsync();
Main entry point for the bargs CLI argument parser.
Provides a combinator-style API for building type-safe CLIs.
Example