@karmaniverous/get-dotenv 4.4.0 → 4.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -113,7 +113,7 @@ You can also use `getdotenv` from the command line:
113
113
  # Options:
114
114
  # -e, --env <string> target environment (dotenv-expanded)
115
115
  # -v, --vars <string> extra variables expressed as delimited key-value pairs (dotenv-expanded): KEY1=VAL1 KEY2=VAL2
116
- # -c, --command <string> shell command string, conflicts with cmd subcommand (dotenv-expanded)
116
+ # -c, --command <string> command executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)
117
117
  # -o, --output-path <string> consolidated output file (dotenv-expanded)
118
118
  # -s, --shell [string] command execution shell, no argument for default OS shell or provide shell string (default OS shell)
119
119
  # -S, --shell-off command execution shell OFF
@@ -150,11 +150,11 @@ You can also use `getdotenv` from the command line:
150
150
  #
151
151
  # Commands:
152
152
  # batch [options] Batch shell commands across multiple working directories.
153
- # cmd execute shell command, conflicts with --command option (default command)
153
+ # cmd batch execute command according to the --shell option, conflicts with --command option (default command)
154
154
  # help [command] display help for command
155
155
  ```
156
156
 
157
- By default, commands (`-c` or `--command` or the `cmd` subcommand) execute in the default OS shell with the `dotenv` context applied. The `-S` or `--shell-off` options will turn this off, and Execa will [execute your command as Javascript](https://github.com/sindresorhus/execa/blob/main/docs/bash.md).
157
+ By default, commands (`-c` or `--command` or the `cmd` subcommand either in the base CLI or in the `batch` subcommand) execute in the default OS shell with the `dotenv` context applied. The `-S` or `--shell-off` options will turn this off, and Execa will [execute your command as Javascript](https://github.com/sindresorhus/execa/blob/main/docs/bash.md).
158
158
 
159
159
  Alternatively, you can use the `-s` or `--shell` option to specify a different shell [following the Execa spec](https://github.com/sindresorhus/execa/blob/main/docs/shell.md). This is useful if you're running a command that requires a specific shell, like `bash` or `zsh`.
160
160
 
@@ -181,19 +181,19 @@ Lest you doubt what that kind of leverage can do for you, consider this:
181
181
 
182
182
  # Usage: getdotenv batch [options] [command]
183
183
  #
184
- # Batch shell commands across multiple working directories.
184
+ # Batch command execution across multiple working directories.
185
185
  #
186
186
  # Options:
187
187
  # -p, --pkg-cwd use nearest package directory as current working directory
188
188
  # -r, --root-path <string> path to batch root directory from current working directory (default: "./")
189
- # -g, --globs <strings...> space-delimited globs from root path (default: "*")
190
- # -c, --command <string> shell command string, conflicts with cmd subcommand (dotenv-expanded)
189
+ # -g, --globs <string> space-delimited globs from root path (default: "*")
190
+ # -c, --command <string> command executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)
191
191
  # -l, --list list working directories without executing command
192
192
  # -e, --ignore-errors ignore errors and continue with next path
193
193
  # -h, --help display help for command
194
194
  #
195
195
  # Commands:
196
- # cmd batch execute shell command, conflicts with --command option (default command)
196
+ # cmd execute command, conflicts with --command option (default subcommand)
197
197
  # help [command] display help for command
198
198
  ```
199
199
 
@@ -31745,7 +31745,9 @@ const getDotenv = async (options = {}) => {
31745
31745
  const resolveCommand = (scripts, command) => (scripts && _.isObject(scripts[command])
31746
31746
  ? scripts[command].cmd
31747
31747
  : scripts?.[command] ?? command);
31748
- const resolveShell = (scripts, command, shell) => (scripts && _.isObject(scripts[command]) ? scripts[command].shell : shell);
31748
+ const resolveShell = (scripts, command, shell) => scripts && _.isObject(scripts[command])
31749
+ ? scripts[command].shell
31750
+ : shell;
31749
31751
 
31750
31752
  /*
31751
31753
  * merge2
@@ -39500,8 +39502,8 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39500
39502
  rootPath,
39501
39503
  });
39502
39504
  const headerTitle = list
39503
- ? 'Listing shell command working directories...'
39504
- : 'Executing shell command batch...';
39505
+ ? 'Listing working directories...'
39506
+ : 'Executing command batch...';
39505
39507
  logger.info('');
39506
39508
  const headerRootPath = `ROOT: ${absRootPath}`;
39507
39509
  const headerGlobs = `GLOBS: ${globs}`;
@@ -39523,7 +39525,7 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39523
39525
  logger.info('*'.repeat(pathLabel.length));
39524
39526
  logger.info(pathLabel);
39525
39527
  logger.info(headerCommand);
39526
- // Execute shell command.
39528
+ // Execute command.
39527
39529
  try {
39528
39530
  await execaCommand(command, {
39529
39531
  cwd: path,
@@ -39547,7 +39549,7 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39547
39549
 
39548
39550
  const cmdCommand$1 = new Command()
39549
39551
  .name('cmd')
39550
- .description('execute shell command, conflicts with --command option (default command)')
39552
+ .description('execute command, conflicts with --command option (default subcommand)')
39551
39553
  .enablePositionalOptions()
39552
39554
  .passThroughOptions()
39553
39555
  .action(async (options, thisCommand) => {
@@ -39557,7 +39559,7 @@ const cmdCommand$1 = new Command()
39557
39559
  throw new Error(`unable to resolve root command`);
39558
39560
  const { getDotenvCliOptions: { logger = console, ...getDotenvCliOptions }, } = thisCommand.parent.parent;
39559
39561
  const { ignoreErrors, globs, list, pkgCwd, rootPath } = thisCommand.parent.opts();
39560
- // Execute shell command.
39562
+ // Execute command.
39561
39563
  {
39562
39564
  const command = thisCommand.args.join(' ');
39563
39565
  await execShellCommandBatch({
@@ -39576,13 +39578,13 @@ const cmdCommand$1 = new Command()
39576
39578
 
39577
39579
  const batchCommand = new Command()
39578
39580
  .name('batch')
39579
- .description('Batch shell commands across multiple working directories.')
39581
+ .description('Batch command execution across multiple working directories.')
39580
39582
  .enablePositionalOptions()
39581
39583
  .passThroughOptions()
39582
39584
  .option('-p, --pkg-cwd', 'use nearest package directory as current working directory')
39583
39585
  .option('-r, --root-path <string>', 'path to batch root directory from current working directory', './')
39584
39586
  .option('-g, --globs <string>', 'space-delimited globs from root path', '*')
39585
- .option('-c, --command <string>', 'command string executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39587
+ .option('-c, --command <string>', 'command executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39586
39588
  .option('-l, --list', 'list working directories without executing command')
39587
39589
  .option('-e, --ignore-errors', 'ignore errors and continue with next path')
39588
39590
  .hook('preSubcommand', async (thisCommand) => {
@@ -39594,7 +39596,7 @@ const batchCommand = new Command()
39594
39596
  logger.error(`--command option conflicts with cmd subcommand.`);
39595
39597
  process.exit(0);
39596
39598
  }
39597
- // Execute shell command.
39599
+ // Execute command.
39598
39600
  if (command)
39599
39601
  await execShellCommandBatch({
39600
39602
  command: resolveCommand(getDotenvCliOptions.scripts, command),
@@ -39612,7 +39614,7 @@ const batchCommand = new Command()
39612
39614
 
39613
39615
  const cmdCommand = new Command()
39614
39616
  .name('cmd')
39615
- .description('batch execute command string according to the --shell option, conflicts with --command option (default command)')
39617
+ .description('batch execute command according to the --shell option, conflicts with --command option (default subcommand)')
39616
39618
  .configureHelp({ showGlobalOptions: true })
39617
39619
  .enablePositionalOptions()
39618
39620
  .passThroughOptions()
@@ -39693,7 +39695,7 @@ const generateGetDotenvCli = async (customOptions) => {
39693
39695
  ]
39694
39696
  .map((v) => v.join(varsAssignor))
39695
39697
  .join(varsDelimiter)}`, dotenvExpandFromProcessEnv)
39696
- .option('-c, --command <string>', 'command string executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39698
+ .option('-c, --command <string>', 'command executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39697
39699
  .option('-o, --output-path <string>', 'consolidated output file (dotenv-expanded)', dotenvExpandFromProcessEnv, outputPath)
39698
39700
  .addOption(new Option('-s, --shell [string]', `command execution shell, no argument for default OS shell or provide shell string${shell ? ` (default ${_.isBoolean(shell) ? 'OS shell' : shell})` : ''}`).conflicts('shellOff'))
39699
39701
  .addOption(new Option('-S, --shell-off', `command execution shell OFF${!shell ? ' (default)' : ''}`).conflicts('shell'))
@@ -39784,7 +39786,7 @@ const generateGetDotenvCli = async (customOptions) => {
39784
39786
  // Execute post-hook.
39785
39787
  if (postHook)
39786
39788
  await postHook(dotenv);
39787
- // Execute shell command.
39789
+ // Execute command.
39788
39790
  if (command && thisCommand.args.length) {
39789
39791
  logger.error(`--command option conflicts with cmd subcommand.`);
39790
39792
  process.exit(0);
package/dist/index.cjs CHANGED
@@ -31746,7 +31746,9 @@ const getDotenv = async (options = {}) => {
31746
31746
  const resolveCommand = (scripts, command) => (scripts && _.isObject(scripts[command])
31747
31747
  ? scripts[command].cmd
31748
31748
  : scripts?.[command] ?? command);
31749
- const resolveShell = (scripts, command, shell) => (scripts && _.isObject(scripts[command]) ? scripts[command].shell : shell);
31749
+ const resolveShell = (scripts, command, shell) => scripts && _.isObject(scripts[command])
31750
+ ? scripts[command].shell
31751
+ : shell;
31750
31752
 
31751
31753
  /*
31752
31754
  * merge2
@@ -39501,8 +39503,8 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39501
39503
  rootPath,
39502
39504
  });
39503
39505
  const headerTitle = list
39504
- ? 'Listing shell command working directories...'
39505
- : 'Executing shell command batch...';
39506
+ ? 'Listing working directories...'
39507
+ : 'Executing command batch...';
39506
39508
  logger.info('');
39507
39509
  const headerRootPath = `ROOT: ${absRootPath}`;
39508
39510
  const headerGlobs = `GLOBS: ${globs}`;
@@ -39524,7 +39526,7 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39524
39526
  logger.info('*'.repeat(pathLabel.length));
39525
39527
  logger.info(pathLabel);
39526
39528
  logger.info(headerCommand);
39527
- // Execute shell command.
39529
+ // Execute command.
39528
39530
  try {
39529
39531
  await execaCommand(command, {
39530
39532
  cwd: path,
@@ -39548,7 +39550,7 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39548
39550
 
39549
39551
  const cmdCommand$1 = new Command()
39550
39552
  .name('cmd')
39551
- .description('execute shell command, conflicts with --command option (default command)')
39553
+ .description('execute command, conflicts with --command option (default subcommand)')
39552
39554
  .enablePositionalOptions()
39553
39555
  .passThroughOptions()
39554
39556
  .action(async (options, thisCommand) => {
@@ -39558,7 +39560,7 @@ const cmdCommand$1 = new Command()
39558
39560
  throw new Error(`unable to resolve root command`);
39559
39561
  const { getDotenvCliOptions: { logger = console, ...getDotenvCliOptions }, } = thisCommand.parent.parent;
39560
39562
  const { ignoreErrors, globs, list, pkgCwd, rootPath } = thisCommand.parent.opts();
39561
- // Execute shell command.
39563
+ // Execute command.
39562
39564
  {
39563
39565
  const command = thisCommand.args.join(' ');
39564
39566
  await execShellCommandBatch({
@@ -39577,13 +39579,13 @@ const cmdCommand$1 = new Command()
39577
39579
 
39578
39580
  const batchCommand = new Command()
39579
39581
  .name('batch')
39580
- .description('Batch shell commands across multiple working directories.')
39582
+ .description('Batch command execution across multiple working directories.')
39581
39583
  .enablePositionalOptions()
39582
39584
  .passThroughOptions()
39583
39585
  .option('-p, --pkg-cwd', 'use nearest package directory as current working directory')
39584
39586
  .option('-r, --root-path <string>', 'path to batch root directory from current working directory', './')
39585
39587
  .option('-g, --globs <string>', 'space-delimited globs from root path', '*')
39586
- .option('-c, --command <string>', 'command string executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39588
+ .option('-c, --command <string>', 'command executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39587
39589
  .option('-l, --list', 'list working directories without executing command')
39588
39590
  .option('-e, --ignore-errors', 'ignore errors and continue with next path')
39589
39591
  .hook('preSubcommand', async (thisCommand) => {
@@ -39595,7 +39597,7 @@ const batchCommand = new Command()
39595
39597
  logger.error(`--command option conflicts with cmd subcommand.`);
39596
39598
  process.exit(0);
39597
39599
  }
39598
- // Execute shell command.
39600
+ // Execute command.
39599
39601
  if (command)
39600
39602
  await execShellCommandBatch({
39601
39603
  command: resolveCommand(getDotenvCliOptions.scripts, command),
@@ -39613,7 +39615,7 @@ const batchCommand = new Command()
39613
39615
 
39614
39616
  const cmdCommand = new Command()
39615
39617
  .name('cmd')
39616
- .description('batch execute command string according to the --shell option, conflicts with --command option (default command)')
39618
+ .description('batch execute command according to the --shell option, conflicts with --command option (default subcommand)')
39617
39619
  .configureHelp({ showGlobalOptions: true })
39618
39620
  .enablePositionalOptions()
39619
39621
  .passThroughOptions()
@@ -39694,7 +39696,7 @@ const generateGetDotenvCli = async (customOptions) => {
39694
39696
  ]
39695
39697
  .map((v) => v.join(varsAssignor))
39696
39698
  .join(varsDelimiter)}`, dotenvExpandFromProcessEnv)
39697
- .option('-c, --command <string>', 'command string executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39699
+ .option('-c, --command <string>', 'command executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39698
39700
  .option('-o, --output-path <string>', 'consolidated output file (dotenv-expanded)', dotenvExpandFromProcessEnv, outputPath)
39699
39701
  .addOption(new Option('-s, --shell [string]', `command execution shell, no argument for default OS shell or provide shell string${shell ? ` (default ${_.isBoolean(shell) ? 'OS shell' : shell})` : ''}`).conflicts('shellOff'))
39700
39702
  .addOption(new Option('-S, --shell-off', `command execution shell OFF${!shell ? ' (default)' : ''}`).conflicts('shell'))
@@ -39785,7 +39787,7 @@ const generateGetDotenvCli = async (customOptions) => {
39785
39787
  // Execute post-hook.
39786
39788
  if (postHook)
39787
39789
  await postHook(dotenv);
39788
- // Execute shell command.
39790
+ // Execute command.
39789
39791
  if (command && thisCommand.args.length) {
39790
39792
  logger.error(`--command option conflicts with cmd subcommand.`);
39791
39793
  process.exit(0);
package/dist/index.mjs CHANGED
@@ -31744,7 +31744,9 @@ const getDotenv = async (options = {}) => {
31744
31744
  const resolveCommand = (scripts, command) => (scripts && _.isObject(scripts[command])
31745
31745
  ? scripts[command].cmd
31746
31746
  : scripts?.[command] ?? command);
31747
- const resolveShell = (scripts, command, shell) => (scripts && _.isObject(scripts[command]) ? scripts[command].shell : shell);
31747
+ const resolveShell = (scripts, command, shell) => scripts && _.isObject(scripts[command])
31748
+ ? scripts[command].shell
31749
+ : shell;
31748
31750
 
31749
31751
  /*
31750
31752
  * merge2
@@ -39499,8 +39501,8 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39499
39501
  rootPath,
39500
39502
  });
39501
39503
  const headerTitle = list
39502
- ? 'Listing shell command working directories...'
39503
- : 'Executing shell command batch...';
39504
+ ? 'Listing working directories...'
39505
+ : 'Executing command batch...';
39504
39506
  logger.info('');
39505
39507
  const headerRootPath = `ROOT: ${absRootPath}`;
39506
39508
  const headerGlobs = `GLOBS: ${globs}`;
@@ -39522,7 +39524,7 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39522
39524
  logger.info('*'.repeat(pathLabel.length));
39523
39525
  logger.info(pathLabel);
39524
39526
  logger.info(headerCommand);
39525
- // Execute shell command.
39527
+ // Execute command.
39526
39528
  try {
39527
39529
  await execaCommand(command, {
39528
39530
  cwd: path,
@@ -39546,7 +39548,7 @@ const execShellCommandBatch = async ({ command, getDotenvCliOptions, globs, igno
39546
39548
 
39547
39549
  const cmdCommand$1 = new Command()
39548
39550
  .name('cmd')
39549
- .description('execute shell command, conflicts with --command option (default command)')
39551
+ .description('execute command, conflicts with --command option (default subcommand)')
39550
39552
  .enablePositionalOptions()
39551
39553
  .passThroughOptions()
39552
39554
  .action(async (options, thisCommand) => {
@@ -39556,7 +39558,7 @@ const cmdCommand$1 = new Command()
39556
39558
  throw new Error(`unable to resolve root command`);
39557
39559
  const { getDotenvCliOptions: { logger = console, ...getDotenvCliOptions }, } = thisCommand.parent.parent;
39558
39560
  const { ignoreErrors, globs, list, pkgCwd, rootPath } = thisCommand.parent.opts();
39559
- // Execute shell command.
39561
+ // Execute command.
39560
39562
  {
39561
39563
  const command = thisCommand.args.join(' ');
39562
39564
  await execShellCommandBatch({
@@ -39575,13 +39577,13 @@ const cmdCommand$1 = new Command()
39575
39577
 
39576
39578
  const batchCommand = new Command()
39577
39579
  .name('batch')
39578
- .description('Batch shell commands across multiple working directories.')
39580
+ .description('Batch command execution across multiple working directories.')
39579
39581
  .enablePositionalOptions()
39580
39582
  .passThroughOptions()
39581
39583
  .option('-p, --pkg-cwd', 'use nearest package directory as current working directory')
39582
39584
  .option('-r, --root-path <string>', 'path to batch root directory from current working directory', './')
39583
39585
  .option('-g, --globs <string>', 'space-delimited globs from root path', '*')
39584
- .option('-c, --command <string>', 'command string executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39586
+ .option('-c, --command <string>', 'command executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39585
39587
  .option('-l, --list', 'list working directories without executing command')
39586
39588
  .option('-e, --ignore-errors', 'ignore errors and continue with next path')
39587
39589
  .hook('preSubcommand', async (thisCommand) => {
@@ -39593,7 +39595,7 @@ const batchCommand = new Command()
39593
39595
  logger.error(`--command option conflicts with cmd subcommand.`);
39594
39596
  process.exit(0);
39595
39597
  }
39596
- // Execute shell command.
39598
+ // Execute command.
39597
39599
  if (command)
39598
39600
  await execShellCommandBatch({
39599
39601
  command: resolveCommand(getDotenvCliOptions.scripts, command),
@@ -39611,7 +39613,7 @@ const batchCommand = new Command()
39611
39613
 
39612
39614
  const cmdCommand = new Command()
39613
39615
  .name('cmd')
39614
- .description('batch execute command string according to the --shell option, conflicts with --command option (default command)')
39616
+ .description('batch execute command according to the --shell option, conflicts with --command option (default subcommand)')
39615
39617
  .configureHelp({ showGlobalOptions: true })
39616
39618
  .enablePositionalOptions()
39617
39619
  .passThroughOptions()
@@ -39692,7 +39694,7 @@ const generateGetDotenvCli = async (customOptions) => {
39692
39694
  ]
39693
39695
  .map((v) => v.join(varsAssignor))
39694
39696
  .join(varsDelimiter)}`, dotenvExpandFromProcessEnv)
39695
- .option('-c, --command <string>', 'command string executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39697
+ .option('-c, --command <string>', 'command executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)', dotenvExpandFromProcessEnv)
39696
39698
  .option('-o, --output-path <string>', 'consolidated output file (dotenv-expanded)', dotenvExpandFromProcessEnv, outputPath)
39697
39699
  .addOption(new Option('-s, --shell [string]', `command execution shell, no argument for default OS shell or provide shell string${shell ? ` (default ${_.isBoolean(shell) ? 'OS shell' : shell})` : ''}`).conflicts('shellOff'))
39698
39700
  .addOption(new Option('-S, --shell-off', `command execution shell OFF${!shell ? ' (default)' : ''}`).conflicts('shell'))
@@ -39783,7 +39785,7 @@ const generateGetDotenvCli = async (customOptions) => {
39783
39785
  // Execute post-hook.
39784
39786
  if (postHook)
39785
39787
  await postHook(dotenv);
39786
- // Execute shell command.
39788
+ // Execute command.
39787
39789
  if (command && thisCommand.args.length) {
39788
39790
  logger.error(`--command option conflicts with cmd subcommand.`);
39789
39791
  process.exit(0);
package/package.json CHANGED
@@ -132,5 +132,5 @@
132
132
  },
133
133
  "type": "module",
134
134
  "types": "dist/index.d.ts",
135
- "version": "4.4.0"
135
+ "version": "4.4.2"
136
136
  }