@epilot/cli 0.1.20 → 0.1.21

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/README.md CHANGED
@@ -29,7 +29,7 @@ npm install -g @epilot/cli
29
29
 
30
30
  <!-- usage-help -->
31
31
  ```
32
- epilot v0.1.20 — CLI for epilot APIs
32
+ epilot v0.1.21 — CLI for epilot APIs
33
33
 
34
34
  USAGE
35
35
  epilot <api> <operationId> [params...] [flags]
@@ -11,7 +11,7 @@ import { defineCommand } from "citty";
11
11
  var main = defineCommand({
12
12
  meta: {
13
13
  name: "epilot",
14
- version: "0.1.20",
14
+ version: "0.1.21",
15
15
  description: "CLI for epilot APIs"
16
16
  },
17
17
  args: {
@@ -31,7 +31,7 @@ var main = defineCommand({
31
31
  profile: () => import("../profile-OZJL5ZPT.js").then((m) => m.default),
32
32
  config: () => import("../config-DGZIMLZK.js").then((m) => m.default),
33
33
  completion: () => import("../completion-INJETNZK.js").then((m) => m.default),
34
- upgrade: () => import("../upgrade-EAQWUJZS.js").then((m) => m.default),
34
+ upgrade: () => import("../upgrade-L2YSFIR2.js").then((m) => m.default),
35
35
  "access-token": () => import("../access-token-WWE6BDJH.js").then((m) => m.default),
36
36
  address: () => import("../address-EH3C4CVB.js").then((m) => m.default),
37
37
  "address-suggestions": () => import("../address-suggestions-RRSLOBFW.js").then((m) => m.default),
@@ -84,6 +84,45 @@ var main = defineCommand({
84
84
  }
85
85
  });
86
86
 
87
+ // src/lib/reorder-args.ts
88
+ var VALUE_TAKING_FLAGS = /* @__PURE__ */ new Set([
89
+ // long
90
+ "--token",
91
+ "--profile",
92
+ "--server",
93
+ "--jsonata",
94
+ "--definition",
95
+ // short
96
+ "-t",
97
+ "-s"
98
+ ]);
99
+ var isFlag = (token) => {
100
+ if (token === "-" || token === "--") return false;
101
+ return token.startsWith("-");
102
+ };
103
+ var consumesNextToken = (token) => {
104
+ if (token.includes("=")) return false;
105
+ return VALUE_TAKING_FLAGS.has(token);
106
+ };
107
+ var hoistFlagsAfterSubcommand = (argv) => {
108
+ let firstPositionalIdx = -1;
109
+ for (let i = 0; i < argv.length; i++) {
110
+ const token = argv[i];
111
+ if (isFlag(token)) {
112
+ if (consumesNextToken(token)) i += 1;
113
+ continue;
114
+ }
115
+ if (token === "--") break;
116
+ firstPositionalIdx = i;
117
+ break;
118
+ }
119
+ if (firstPositionalIdx <= 0) return argv.slice();
120
+ const leading = argv.slice(0, firstPositionalIdx);
121
+ const subcommand = argv[firstPositionalIdx];
122
+ const rest = argv.slice(firstPositionalIdx + 1);
123
+ return [subcommand, ...rest, ...leading];
124
+ };
125
+
87
126
  // bin/epilot.ts
88
127
  process.stdout.on("error", (err) => {
89
128
  if (err.code === "EPIPE") process.exit(0);
@@ -93,7 +132,9 @@ process.stderr.on("error", (err) => {
93
132
  if (err.code === "EPIPE") process.exit(0);
94
133
  throw err;
95
134
  });
96
- var VERSION = true ? "0.1.20" : (await null).default.version;
135
+ var VERSION = true ? "0.1.21" : (await null).default.version;
136
+ var reorderedArgv = hoistFlagsAfterSubcommand(process.argv.slice(2));
137
+ process.argv = [process.argv[0], process.argv[1], ...reorderedArgv];
97
138
  var args = process.argv.slice(2);
98
139
  var completionsIdx = args.indexOf("--_completions");
99
140
  if (completionsIdx >= 0) {
@@ -72,7 +72,7 @@ ${GREEN}${BOLD}Upgraded to @epilot/cli@${latest}${RESET}
72
72
  }
73
73
  });
74
74
  var getCurrentVersion = () => {
75
- if (true) return "0.1.20";
75
+ if (true) return "0.1.21";
76
76
  try {
77
77
  const output = execSync("npm ls -g @epilot/cli --depth=0 --json 2>/dev/null", {
78
78
  encoding: "utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/cli",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "CLI for epilot APIs",
5
5
  "type": "module",
6
6
  "bin": {