yaro/yaro-create-cli/examples/single-command.js
import process from 'node:process';
import { yaroParse } from 'yaro-parser';
import { yaroCommand } from 'yaro-command';
// import ipFilter from 'ip-filter';
import { yaroCreateCli } from '../src/index.js';
const xaxa = yaroCommand('<foo> [...bars]', 'sasass sasa').action(
(options, foo, bars) => {
console.log('xaxa linting', { options, foo, bars });
// trying external error
// ipFilter('sasasasa');
},
);
// const bar = yaroCommand('<abc> [...qux]', 'sasass sasa').action(
// (options, abc, qux) => {
// console.log('bar linting', { options, abc, qux });
// },
// );
// const sasa = yaroCommand('gaga [...files]', async (options, files) => {
// console.log('gaga: formatting and linting files', { options, files });
// });
// const simple = yaroCommand((options, arg) => {
// console.log('simple cmd', { options });
// });
await yaroCreateCli(process.argv.slice(2), {
commands: { xaxa },
// rootCommand: yaroCommand('hela', 'Software dev & management')
// .option('--cwd', 'Current working directory', process.cwd())
// .option('-c, --config', 'Path to configuration file', 'hela.config.js')
// .action((globalOptions) => {
// console.log('some root!');
// // return false;
// }),
name: 'single-command',
version: '0.1.0',
exit: process.exit,
yaroParse,
yaroCommand,
});