import { createRequire } from 'node:module'; import { Command } from '@commander-js/extra-typings'; import { parseArgList } from './utils.js'; // TODO: once we drop support for node [...args]') .option('-e, --environments [envs...]', 'The rc file environment(s) to use', parseArgList) .option('-f, --file [path]', 'Custom env file path (default path: ./.env)') .option('-r, --rc-file [path]', 'Custom rc file path (default path: ./.env-cmdrc.(js|cjs|mjs|json)') .option('-x, --expand-envs', 'Replace $var in args and command with environment variables') .option('--fallback', 'Fallback to default env file path, if custom env file path not found') .option('--no-override', 'Do not override existing environment variables') .option('--silent', 'Ignore any env-cmd errors and only fail on executed program failure.') .option('--use-shell', 'Execute the command in a new shell with the given environment') .option('--verbose', 'Print helpful debugging information') .allowUnknownOption(true) .allowExcessArguments(true) .parse(['_', '_', ...args], { from: 'node' }); }