From b0f120a27ba10b363d8e72b8e818dc79e236f31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=BBenta=C5=82a?= Date: Tue, 28 May 2024 14:27:30 +0200 Subject: [PATCH] Fix: Allow dashes in environment variable names Updated the regex in `validateCmdVariable` to support environment variable names containing dashes (`-`). Modified the pattern from `^(\w+)=([\s\S]+)$` to `^([\w-]+)=([\s\S]+)$` to include dashes alongside alphanumeric characters and underscores. This change enables the correct parsing of variables with dashes in `.env` files. --- cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli.js b/cli.js index c1c7c21..e146d91 100755 --- a/cli.js +++ b/cli.js @@ -56,7 +56,7 @@ if (argv.c) { } function validateCmdVariable (param) { - const [, key, val] = param.match(/^(\w+)=([\s\S]+)$/m) || [] + const [, key, val] = param.match(/^([\w-]+)=([\s\S]+)$/m) || [] if (!key || !val) { console.error(`Invalid variable name. Expected variable in format '-v variable=value', but got: \`-v ${param}\`.`) process.exit(1)