diff --git a/src/main.ts b/src/main.ts index 99d0444..e1f09c9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,11 @@ import { execSync } from 'node:child_process' import process from 'node:process' -import { checkbox, confirm } from '@inquirer/prompts' +import { checkbox, confirm, input } from '@inquirer/prompts' import { createVueMetamorphCli } from 'vue-metamorph' import { vuetify4 } from './plugins/v4' +const argv = (...args: string[]) => ['node', 'cli', ...args]; + try { try { execSync('git diff --quiet', { stdio: 'ignore' }) @@ -14,6 +16,8 @@ try { if (!cont) process.exit() } + const path = await input({ message: "Target directory:", default: "." }) + const choices = await checkbox({ message: 'Select codemods to apply', required: true, @@ -75,7 +79,7 @@ try { process.on('SIGTERM', cli.abort) process.on('SIGINT', cli.abort) - await cli.run() + await cli.run(argv('--files', `${path}/**/*`, )) } catch (error) { if (!(error instanceof Error && error.name === 'ExitPromptError')) { throw error