init
Initialize your CLI after defining its commands.
Handling Yargs Output Manually
import * as cli from '@darkobits/saffron';
// Configure commands for the application.
cli.command({
// ...
});
cli.command({
// ...
});
cli.init(yargs => {
yargs.wrap(120);
// Optionally return a ParseCallback.
return (err, argv, output) => {
if (err) {
process.stderr.write(err.message);
process.exit(err.code ?? 1);
}
if (output) {
process.stdout.write(output);
process.exit(0);
}
};
});Last updated