UNPKG

alia

Version:
21 lines (20 loc) 613 B
import { CommandService } from './command.service.js'; import { FlagService } from './flag.service.js'; import logger from '../utils/logger.js'; import { inject } from '../utils/di.js'; export class InputService { #flagService = inject(FlagService); #commandService = inject(CommandService); async read() { try { const argv = process.argv.slice(2); const flag = await this.#flagService.run(argv); if (!flag) { this.#commandService.run(argv); } } catch (error) { logger.error(error); } } }