@dotenvx/dotenvx
Advanced tools
Comparing version 1.12.1 to 1.13.0
@@ -5,4 +5,8 @@ # Changelog | ||
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.12.1...main) | ||
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.13.0...main) | ||
## 1.13.0 | ||
* move `ls` to core commands ([#367](https://github.com/dotenvx/dotenvx/pull/367)) | ||
## 1.12.1 | ||
@@ -9,0 +13,0 @@ |
{ | ||
"version": "1.12.1", | ||
"version": "1.13.0", | ||
"name": "@dotenvx/dotenvx", | ||
@@ -4,0 +4,0 @@ "description": "a better dotenv–from the creator of `dotenv`", |
@@ -1050,7 +1050,7 @@ [![dotenvx](https://dotenvx.com/better-banner.png)](https://dotenvx.com) | ||
```sh | ||
$ echo "HELLO=World\n" > .env | ||
$ echo "KEY=value\n" >> .env | ||
$ echo "HELLO=World" > .env | ||
$ echo "KEY=value" >> .env | ||
$ dotenvx get --format shell | ||
HELLO="World" KEY="value" | ||
HELLO=World KEY=value | ||
``` | ||
@@ -1057,0 +1057,0 @@ |
@@ -5,2 +5,3 @@ const { Command } = require('commander') | ||
const executeExtension = require('../../lib/helpers/executeExtension') | ||
const removeDynamicHelpSection = require('../../lib/helpers/removeDynamicHelpSection') | ||
@@ -30,3 +31,3 @@ const ext = new Command('ext') | ||
.option('-ef, --exclude-env-file <excludeFilenames...>', 'path(s) to exclude from your env file(s) (default: none)') | ||
.action(require('./../actions/ext/ls')) | ||
.action(require('./../actions/ls')) | ||
@@ -64,2 +65,12 @@ // dotenvx ext genexample | ||
// overide helpInformation to hide dynamic commands | ||
ext.helpInformation = function () { | ||
const originalHelp = Command.prototype.helpInformation.call(this) | ||
const lines = originalHelp.split('\n') | ||
removeDynamicHelpSection(lines) | ||
return lines.join('\n') | ||
} | ||
module.exports = ext |
@@ -11,2 +11,3 @@ #!/usr/bin/env node | ||
const executeDynamic = require('./../lib/helpers/executeDynamic') | ||
const removeDynamicHelpSection = require('./../lib/helpers/removeDynamicHelpSection') | ||
@@ -34,4 +35,3 @@ // for use with run | ||
program.addHelpText('after', ' pro 🏆 pro\n') | ||
// for dynamic loading of dotenvx-pro, etc | ||
program | ||
@@ -47,3 +47,3 @@ .argument('[command]', 'dynamic command') | ||
program | ||
.name(packageJson.name) | ||
.name('dotenvx') | ||
.description(packageJson.description) | ||
@@ -121,2 +121,11 @@ .version(packageJson.version) | ||
// dotenvx ls | ||
const lsAction = require('./actions/ls') | ||
program.command('ls') | ||
.description('print all .env files in a tree structure') | ||
.argument('[directory]', 'directory to list .env files from', '.') | ||
.option('-f, --env-file <filenames...>', 'path(s) to your env file(s)', '.env*') | ||
.option('-ef, --exclude-env-file <excludeFilenames...>', 'path(s) to exclude from your env file(s) (default: none)') | ||
.action(lsAction) | ||
// dotenvx help | ||
@@ -138,2 +147,8 @@ program.command('help [command]') | ||
// dotenvx pro | ||
program.addHelpText('after', ' ') | ||
program.addHelpText('after', 'Advanced: ') | ||
program.addHelpText('after', ' pro 🏆 pro') | ||
program.addHelpText('after', ' ext 🔌 extensions') | ||
// dotenvx ext | ||
@@ -166,3 +181,3 @@ program.addCommand(require('./commands/ext')) | ||
// overide helpInformation to hide DEPRECATED commands | ||
// overide helpInformation to hide DEPRECATED and 'ext' commands | ||
program.helpInformation = function () { | ||
@@ -172,4 +187,10 @@ const originalHelp = Command.prototype.helpInformation.call(this) | ||
removeDynamicHelpSection(lines) | ||
// Filter out the hidden command from the help output | ||
const filteredLines = lines.filter(line => !line.includes('DEPRECATED') && !line.includes('help [command]')) | ||
const filteredLines = lines.filter(line => | ||
!line.includes('DEPRECATED') && | ||
!line.includes('help [command]') && | ||
!line.includes('🔌 extensions') | ||
) | ||
@@ -176,0 +197,0 @@ return filteredLines.join('\n') |
@@ -8,3 +8,3 @@ const path = require('path') | ||
ext.outputHelp() | ||
process.exit(1) | ||
process.exit(0) | ||
return | ||
@@ -11,0 +11,0 @@ } |
193049
70
3296