@luxkit/cli 1.0.5 → 1.0.6
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/dist/index.js +9 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -938,13 +938,14 @@ function getEnvConfig() {
|
|
|
938
938
|
const eqIndex = trimmed.indexOf("=");
|
|
939
939
|
if (eqIndex === -1) continue;
|
|
940
940
|
const key = trimmed.slice(0, eqIndex).trim();
|
|
941
|
-
const
|
|
941
|
+
const raw = trimmed.slice(eqIndex + 1).trim();
|
|
942
|
+
const value = raw.replace(/^["']|["']$/g, "");
|
|
942
943
|
if (key) result[key] = value;
|
|
943
944
|
}
|
|
944
945
|
return result;
|
|
945
946
|
}
|
|
946
947
|
function setEnvConfig(data) {
|
|
947
|
-
const lines = Object.entries(data).filter(([, v]) => v !== "").map(([k, v]) => `${k}
|
|
948
|
+
const lines = Object.entries(data).filter(([, v]) => v !== "").map(([k, v]) => `${k}="${v}"`);
|
|
948
949
|
writeFile(getEnvConfigPath(), lines.join("\n") + "\n");
|
|
949
950
|
}
|
|
950
951
|
function clearEnvConfig() {
|
|
@@ -963,7 +964,7 @@ function handleShowEnv() {
|
|
|
963
964
|
return;
|
|
964
965
|
}
|
|
965
966
|
for (const [key, value] of entries) {
|
|
966
|
-
logger.log(`${key}
|
|
967
|
+
logger.log(`${key}="${value}"`);
|
|
967
968
|
}
|
|
968
969
|
}
|
|
969
970
|
function registerShowCommand(program2) {
|
|
@@ -1805,14 +1806,14 @@ function registerVscodeCommand(program2) {
|
|
|
1805
1806
|
import { spawnSync } from "child_process";
|
|
1806
1807
|
var ALLOWED_KEYS = ["https_proxy", "http_proxy", "all_proxy"];
|
|
1807
1808
|
function buildCommands(shell, env) {
|
|
1808
|
-
const entries = Object.entries(env)
|
|
1809
|
+
const entries = Object.entries(env);
|
|
1809
1810
|
if (shell === "cmd") {
|
|
1810
|
-
return entries.map((
|
|
1811
|
+
return entries.map(([k, v]) => `set ${k}=${v}`).join(" && ");
|
|
1811
1812
|
}
|
|
1812
1813
|
if (shell === "bash") {
|
|
1813
|
-
return entries.map((
|
|
1814
|
+
return entries.map(([k, v]) => `export ${k}="${v}"`).join(" && ");
|
|
1814
1815
|
}
|
|
1815
|
-
return entries.map((
|
|
1816
|
+
return entries.map(([k, v]) => `$env:${k}="${v}"`).join(" ; ");
|
|
1816
1817
|
}
|
|
1817
1818
|
function copyToClipboard(text) {
|
|
1818
1819
|
const result = spawnSync("clip", [], { input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
@@ -1856,7 +1857,7 @@ function handleSet(args) {
|
|
|
1856
1857
|
}
|
|
1857
1858
|
const eqIndex = arg.indexOf("=");
|
|
1858
1859
|
const key = arg.slice(0, eqIndex);
|
|
1859
|
-
const value = arg.slice(eqIndex + 1);
|
|
1860
|
+
const value = arg.slice(eqIndex + 1).replace(/^["']|["']$/g, "");
|
|
1860
1861
|
if (!isValidKey(key)) {
|
|
1861
1862
|
logger.error(`Invalid key: "${key}". Allowed keys: ${ALLOWED_KEYS.join(", ")}`);
|
|
1862
1863
|
return;
|