MCPcopy
hub / github.com/dotenvx/dotenvx / inferCommandArgsFromProcessArgv

Function inferCommandArgsFromProcessArgv

src/cli/actions/run.js:16–37  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

14const { determine } = require('./../../lib/helpers/envResolution')
15
16function inferCommandArgsFromProcessArgv (argv) {
17 const runIndex = argv.indexOf('run')
18 if (runIndex === -1) return []
19
20 const args = argv.slice(runIndex + 1)
21
22 const separatorIndex = args.indexOf('--')
23 if (separatorIndex !== -1) return args.slice(separatorIndex + 1)
24
25 for (let i = 0; i < args.length; i++) {
26 if (args[i] === '-f' || args[i] === '--env-file') {
27 i++
28 continue
29 }
30
31 if (args[i].startsWith('-')) continue
32
33 return args.slice(i)
34 }
35
36 return []
37}
38
39function uniqueInjectedKeys (processedEnvs) {
40 const result = new Set()

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…