Jolg42 / cli-wrapping-dotenv-flow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples of wrapping a CLI for dotenv-flow

A npm script

Disadvantage of requiring -- for flags.

# Note the required `--` for command flags
npm run prisma -- -v

# Another usage with env
env NODE_ENV=production npm run prisma migrate status -- --preview-feature

# Note again that flags necessary for prisma CLI need to be after `--`

# This errors with `Please provide the --preview-feature flag to use this command.`
npm run prisma migrate status --preview-feature

# And all of these work
npm run prisma migrate status -- --preview-feature
npm run prisma migrate -- status --preview-feature
npm run prisma -- migrate status --preview-feature
npm run -- prisma migrate status --preview-feature
npm -- run prisma migrate status --preview-feature

Spawn from a Node script

Proxing like this has the big advantage that prompts are working like with the original CLI.

# The "prisma" scripts first loads dotenv-flow and then spawns the Prisma CLI
NODE_ENV=production node prisma migrate status --preview-feature

About


Languages

Language:JavaScript 100.0%