@zhongqian97-code/ecode 0.0.2 → 0.0.4
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 +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { createRequire } from "module";
|
|
5
|
+
|
|
3
6
|
// src/config.ts
|
|
4
7
|
import { existsSync, readFileSync } from "fs";
|
|
5
8
|
import { homedir } from "os";
|
|
@@ -271,6 +274,13 @@ async function startRepl(config2) {
|
|
|
271
274
|
}
|
|
272
275
|
|
|
273
276
|
// src/index.ts
|
|
277
|
+
var require2 = createRequire(import.meta.url);
|
|
278
|
+
var { version } = require2("../package.json");
|
|
279
|
+
var arg = process.argv[2];
|
|
280
|
+
if (arg === "-v" || arg === "--version") {
|
|
281
|
+
console.log(version);
|
|
282
|
+
process.exit(0);
|
|
283
|
+
}
|
|
274
284
|
var config = loadConfig();
|
|
275
285
|
if (!config.apiKey) {
|
|
276
286
|
console.error(
|