@@ -9,9 +9,10 @@ const dotenvExpand = require('dotenv-expand').expand
99
1010function printHelp ( ) {
1111 console . log ( [
12- 'Usage: dotenv [--help] [--debug] [-e <path>] [-v <name>=<value>] [-p <variable name>] [-c [environment]] [--no-expand] [-- command]' ,
12+ 'Usage: dotenv [--help] [--debug] [--quiet=false] [- e <path>] [-v <name>=<value>] [-p <variable name>] [-c [environment]] [--no-expand] [-- command]' ,
1313 ' --help print help' ,
1414 ' --debug output the files that would be processed but don\'t actually parse them or run the `command`' ,
15+ ' --quiet, -q suppress debug output from dotenv (default: true)' ,
1516 ' -e <path> parses the file <path> as a `.env` file and adds the variables to the environment' ,
1617 ' -e <path> multiple -e flags are allowed' ,
1718 ' -v <name>=<value> put variable <name> into environment using value <value>' ,
@@ -31,6 +32,9 @@ if (argv.help) {
3132
3233const override = argv . o || argv . override
3334
35+ // Handle quiet flag - default is true (quiet), can be disabled with --quiet=false or -q=false
36+ const isQuiet = ! ( argv . quiet === false || argv . q === false || argv . quiet === 'false' || argv . q === 'false' )
37+
3438if ( argv . c && override ) {
3539 console . error ( 'Invalid arguments. Cascading env variables conflicts with overrides.' )
3640 process . exit ( 1 )
@@ -81,14 +85,14 @@ if (argv.debug) {
8185}
8286
8387paths . forEach ( function ( env ) {
84- dotenv . config ( { path : path . resolve ( env ) , override } )
88+ dotenv . config ( { path : path . resolve ( env ) , override, quiet : isQuiet } )
8589} )
8690
8791// Expand when all path configs are loaded
8892if ( argv . expand !== false ) {
8993 dotenvExpand ( {
9094 parsed : process . env
91- } ) ;
95+ } )
9296}
9397Object . assign ( process . env , parsedVariables )
9498
0 commit comments