@gzl10/osx-cli 4.0.1 → 4.0.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.
Files changed (2) hide show
  1. package/dist/cli.js +14 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5,6 +5,9 @@ import {
5
5
  } from "./chunk-ILUPEXRP.js";
6
6
 
7
7
  // src/cli.ts
8
+ import { readFileSync as readFileSync2 } from "fs";
9
+ import { dirname, join as join2 } from "path";
10
+ import { fileURLToPath } from "url";
8
11
  import { program } from "commander";
9
12
 
10
13
  // src/commands/extract.ts
@@ -14,14 +17,18 @@ import { join } from "path";
14
17
  function loadHomeEnv() {
15
18
  const envPath = join(homedir(), ".env");
16
19
  if (!existsSync(envPath)) return {};
17
- const content = readFileSync(envPath, "utf-8");
20
+ const content = readFileSync(envPath, "utf-8").replace(/^\uFEFF/, "");
18
21
  const vars = {};
19
- for (const line of content.split("\n")) {
20
- const match = line.match(/^(\w+)=(.*)$/);
22
+ for (const line of content.split(/\r?\n/)) {
23
+ const trimmed = line.trim();
24
+ const match = trimmed.match(/^(\w+)=(.*)$/);
21
25
  if (match) {
22
- vars[match[1]] = match[2].replace(/^["']|["']$/g, "");
26
+ vars[match[1]] = match[2].replace(/^["']|["']$/g, "").trim();
23
27
  }
24
28
  }
29
+ if (vars.USER || vars.PWD) {
30
+ console.error(`Usando credenciales de ${envPath}`);
31
+ }
25
32
  return {
26
33
  user: vars.USER,
27
34
  password: vars.PWD
@@ -161,6 +168,8 @@ async function extractCommand(tables, options) {
161
168
  }
162
169
 
163
170
  // src/cli.ts
164
- program.name("osx").description("Oracle Schema Extractor - Genera JSON compatible con Atlas OriginType=BBDD").version("1.0.0");
171
+ var __dirname2 = dirname(fileURLToPath(import.meta.url));
172
+ var pkg = JSON.parse(readFileSync2(join2(__dirname2, "..", "package.json"), "utf-8"));
173
+ program.name("osx").description("Oracle Schema Extractor - Genera JSON compatible con Atlas OriginType=BBDD").version(pkg.version);
165
174
  program.command("extract <tables>").description("Extrae esquema de tabla(s) Oracle. Tablas separadas por coma.").option("-t, --tns <alias>", "Alias TNS o Easy Connect (host:port/service)").option("-s, --schema <name>", "Schema Oracle (default: mismo que TNS)").option("-u, --user <user>", "Usuario Oracle (o env: OSX_USER)").option("-p, --password <pass>", "Password Oracle (o env: OSX_PASSWORD)").option("-o, --output <file>", "Fichero de salida (default: stdout)").option("--pretty", "JSON formateado con indentacion").option("-d, --delay <ms>", "Delay entre tablas en ms", "0").action(extractCommand);
166
175
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gzl10/osx-cli",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Oracle Schema Extractor CLI - Genera JSON compatible con Atlas OriginType=BBDD",
5
5
  "type": "module",
6
6
  "bin": {