@acomo/cli 1.0.2 → 1.0.3

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 CHANGED
@@ -26,6 +26,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
 
29
+ // src/index.ts
30
+ var import_fs6 = require("fs");
31
+ var import_path6 = require("path");
32
+ var import_url2 = require("url");
33
+
29
34
  // ../node_modules/yargs/lib/platform-shims/esm.mjs
30
35
  var import_assert = require("assert");
31
36
 
@@ -1548,13 +1553,13 @@ var y18n_default = y18n2;
1548
1553
  var import_meta = {};
1549
1554
  var REQUIRE_ERROR = "require is not supported by ESM";
1550
1555
  var REQUIRE_DIRECTORY_ERROR = "loading a directory of commands is not supported yet for ESM";
1551
- var __dirname;
1556
+ var __dirname2;
1552
1557
  try {
1553
- __dirname = (0, import_url.fileURLToPath)(import_meta.url);
1558
+ __dirname2 = (0, import_url.fileURLToPath)(import_meta.url);
1554
1559
  } catch (e) {
1555
- __dirname = process.cwd();
1560
+ __dirname2 = process.cwd();
1556
1561
  }
1557
- var mainFilename = __dirname.substring(0, __dirname.lastIndexOf("node_modules"));
1562
+ var mainFilename = __dirname2.substring(0, __dirname2.lastIndexOf("node_modules"));
1558
1563
  var esm_default = {
1559
1564
  assert: {
1560
1565
  notStrictEqual: import_assert.notStrictEqual,
@@ -1599,7 +1604,7 @@ var esm_default = {
1599
1604
  return [...str].length;
1600
1605
  },
1601
1606
  y18n: y18n_default({
1602
- directory: (0, import_path4.resolve)(__dirname, "../../../locales"),
1607
+ directory: (0, import_path4.resolve)(__dirname2, "../../../locales"),
1603
1608
  updateFiles: false
1604
1609
  })
1605
1610
  };
@@ -3832,12 +3837,12 @@ var YargsInstance = class {
3832
3837
  async getCompletion(args, done) {
3833
3838
  argsert("<array> [function]", [args, done], arguments.length);
3834
3839
  if (!done) {
3835
- return new Promise((resolve5, reject) => {
3840
+ return new Promise((resolve6, reject) => {
3836
3841
  __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
3837
3842
  if (err)
3838
3843
  reject(err);
3839
3844
  else
3840
- resolve5(completions);
3845
+ resolve6(completions);
3841
3846
  });
3842
3847
  });
3843
3848
  } else {
@@ -12255,7 +12260,7 @@ async function promptInput(question, hidden = false) {
12255
12260
  input: process.stdin,
12256
12261
  output: process.stdout
12257
12262
  });
12258
- return new Promise((resolve5) => {
12263
+ return new Promise((resolve6) => {
12259
12264
  if (hidden) {
12260
12265
  const stdin = process.stdin;
12261
12266
  if (stdin.setRawMode) stdin.setRawMode(true);
@@ -12268,7 +12273,7 @@ async function promptInput(question, hidden = false) {
12268
12273
  if (stdin.setRawMode) stdin.setRawMode(false);
12269
12274
  process.stdout.write("\n");
12270
12275
  rl.close();
12271
- resolve5(password);
12276
+ resolve6(password);
12272
12277
  } else if (c === "") {
12273
12278
  process.exit(130);
12274
12279
  } else if (c === "\x7F") {
@@ -12284,7 +12289,7 @@ async function promptInput(question, hidden = false) {
12284
12289
  } else {
12285
12290
  rl.question(question, (answer) => {
12286
12291
  rl.close();
12287
- resolve5(answer);
12292
+ resolve6(answer);
12288
12293
  });
12289
12294
  }
12290
12295
  });
@@ -12559,6 +12564,8 @@ var operationDescriptions = {
12559
12564
  };
12560
12565
 
12561
12566
  // src/index.ts
12567
+ var import_meta2 = {};
12568
+ var scriptDir = typeof __dirname !== "undefined" ? __dirname : (0, import_path6.dirname)((0, import_url2.fileURLToPath)(import_meta2.url));
12562
12569
  async function resolveParams(positional) {
12563
12570
  if (positional) {
12564
12571
  try {
@@ -12608,13 +12615,16 @@ function handleError(error) {
12608
12615
  process.exit(1);
12609
12616
  }
12610
12617
  async function main() {
12618
+ const pkg = JSON.parse(
12619
+ (0, import_fs6.readFileSync)((0, import_path6.resolve)(scriptDir, "../package.json"), "utf-8")
12620
+ );
12611
12621
  const argv = yargs_default(hideBin(process.argv)).scriptName("acomo").usage("Usage: $0 <command> [options]").option("format", {
12612
12622
  alias: "f",
12613
12623
  type: "string",
12614
12624
  description: "\u51FA\u529B\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8",
12615
12625
  choices: ["json", "compact"],
12616
12626
  default: "json"
12617
- }).help().alias("h", "help").version().alias("v", "version");
12627
+ }).help().alias("h", "help").version(pkg.version).alias("v", "version");
12618
12628
  argv.command(
12619
12629
  command2(),
12620
12630
  describe(),