@hairy/lnv
Version:
_description_
49 lines (46 loc) • 1.19 kB
JavaScript
import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
import {
lnv
} from "./chunk-4A43HXQH.js";
// src/cli/lnv.ts
async function registerLnvCommand(cli) {
const args = cli.usage("lnv <entry> [args]").alias("h", "help").option("value", {
describe: "set environment variables",
type: "array",
alias: "v"
}).option("depth", {
describe: "depth find and merge environment variables",
type: "boolean",
alias: "d"
}).option("entry", {
describe: "Manual selection entry",
type: "array",
alias: "e"
}).option("run", {
describe: "load runtime environment and run any scripts",
type: "string",
alias: "r"
}).option("write", {
describe: "expose and write environment variables to .env file",
type: "boolean"
}).help().parse();
const entries = [...args._ || [], ...args.entry || []];
const env = args.value?.reduce(
(acc, cur) => {
const [key, value] = cur.split("=");
acc[key] = value;
return acc;
},
{}
);
await lnv({
write: args.write,
run: args.run,
depth: args.depth,
entries,
env
});
}
export {
registerLnvCommand
};