text command parser for conduit
npm install @myri/conduit-text-parsertext command parser for conduit manifests, powered by commander.js.
``bash`
npm install @myri/conduit-text-parser
most users should use @myri/conduit-adapter-shell instead, which wraps this package with a complete cli adapter.
use this package directly when you:
- need to parse text commands without running them (e.g., for validation)
- are building a custom adapter that needs text parsing
- want to integrate command parsing into a non-cli context
`typescript
import { manifest, command, arg } from '@myri/conduit';
import { TextParser, parseText } from '@myri/conduit-text-parser';
const app = manifest('myapp', '1.0.0')
.command(command('greet').arg(arg('name', 'string').required()))
.build();
// one-shot parsing
const result = parseText(app, 'greet --name madi');
// result.path = 'greet'
// result.rawArgs = { name: 'madi' }
// or use the class for repeated parsing
const parser = new TextParser(app, {
onCommand: (result) => console.log(result),
});
parser.run(['greet', '--name', 'madi']);
``
- @myri/conduit-adapter-shell - full cli adapter
- @myri/conduit - core library