mirror of
https://github.com/toddbluhm/env-cmd.git
synced 2025-12-08 18:23:33 +00:00
22 lines
587 B
JavaScript
22 lines
587 B
JavaScript
import * as processLib from 'node:process';
|
|
import { EnvCmd } from './env-cmd.js';
|
|
import { parseArgs } from './parse-args.js';
|
|
/**
|
|
* Executes env - cmd using command line arguments
|
|
* @export
|
|
* @param {string[]} args Command line argument to pass in ['-f', './.env']
|
|
* @returns {Promise<Environment>}
|
|
*/
|
|
export async function CLI(args) {
|
|
// Parse the args from the command line
|
|
const parsedArgs = parseArgs(args);
|
|
// Run EnvCmd
|
|
try {
|
|
return await EnvCmd(parsedArgs);
|
|
}
|
|
catch (e) {
|
|
console.error(e);
|
|
return processLib.exit(1);
|
|
}
|
|
}
|