@binaryandthread/cli 0.4.5 → 0.4.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/bin.js +23 -27
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-PG7YCPAN.js → chunk-5W5O6G6Y.js} +207 -21
- package/dist/chunk-5W5O6G6Y.js.map +1 -0
- package/dist/{interactive-HI3LDK5U.js → interactive-I6KDKLEO.js} +6 -5
- package/dist/interactive-I6KDKLEO.js.map +1 -0
- package/package.json +2 -1
- package/dist/chunk-PG7YCPAN.js.map +0 -1
- package/dist/interactive-HI3LDK5U.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
isCartTaxInclusive,
|
|
37
37
|
lineColour,
|
|
38
38
|
ok,
|
|
39
|
+
orderStage,
|
|
39
40
|
priceLine,
|
|
40
41
|
printResult,
|
|
41
42
|
productColours,
|
|
@@ -55,7 +56,7 @@ import {
|
|
|
55
56
|
versionLine,
|
|
56
57
|
warn,
|
|
57
58
|
working
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-5W5O6G6Y.js";
|
|
59
60
|
import {
|
|
60
61
|
__require
|
|
61
62
|
} from "./chunk-7OCVIDC7.js";
|
|
@@ -104,7 +105,7 @@ function makeLogger(debug, write = (s) => process.stderr.write(s)) {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
// src/version.ts
|
|
107
|
-
var VERSION = "0.4.
|
|
108
|
+
var VERSION = "0.4.6";
|
|
108
109
|
|
|
109
110
|
// src/eggs.ts
|
|
110
111
|
function teapot() {
|
|
@@ -524,7 +525,7 @@ function registerBrowse(program, makeClient2, loadConfig2) {
|
|
|
524
525
|
program.command("browse").alias("ls").description("list what's in stock on a branch.").option("--branch <branch>", "main (live) or next (terminal-only drops)").option("--pick", "opt into the arrow-key picker (default is the numbered table \u2014 use bt stage <n>)").option("--plain", "force the static table (the default; kept for back-compat)").action(async (opts) => {
|
|
525
526
|
const { json, brand } = resolveOutput(program);
|
|
526
527
|
if (opts.pick && !json && brand.color && process.stdout.isTTY && process.stdin.isTTY) {
|
|
527
|
-
const { runInteractiveBrowse } = await import("./interactive-
|
|
528
|
+
const { runInteractiveBrowse } = await import("./interactive-I6KDKLEO.js");
|
|
528
529
|
const handled = await runInteractiveBrowse(makeClient2(), loadConfig2(), { branch: opts.branch, brand });
|
|
529
530
|
if (handled) return;
|
|
530
531
|
}
|
|
@@ -1093,11 +1094,8 @@ function registerCheckout(program, makeClient2, loadConfig2) {
|
|
|
1093
1094
|
// src/commands/order.ts
|
|
1094
1095
|
var STAGES = ["staged", "committed", "printed", "shipped", "delivered"];
|
|
1095
1096
|
function stageIndex(o) {
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
if (f.includes("shipped")) return 3;
|
|
1099
|
-
if (f.includes("fulfilled") || f.includes("printed") || f.includes("partially_shipped")) return 2;
|
|
1100
|
-
return 1;
|
|
1097
|
+
const stage = orderStage(o);
|
|
1098
|
+
return stage === "reverted" ? -1 : STAGES.indexOf(stage);
|
|
1101
1099
|
}
|
|
1102
1100
|
function timelineGraph(idx) {
|
|
1103
1101
|
const dots = STAGES.map((_s, i) => i <= idx ? "\u25CF" : "\u25CB").join("\u2500\u2500");
|
|
@@ -1130,12 +1128,18 @@ async function runOrder(client, config, args) {
|
|
|
1130
1128
|
const itemLabel = first ? `${first.title ?? "item"}${first.variant_title ? ` \xB7 ${first.variant_title}` : ""}` : "your order";
|
|
1131
1129
|
const style = brandOf(args);
|
|
1132
1130
|
const lines = [];
|
|
1133
|
-
|
|
1134
|
-
|
|
1131
|
+
const stageWord = idx < 0 ? "reverted" : STAGES[idx];
|
|
1132
|
+
if (idx < 0) {
|
|
1133
|
+
lines.push(`${display} ${itemLabel} reverted`);
|
|
1134
|
+
lines.push(` this order was canceled or refunded. nothing ships.`);
|
|
1135
|
+
} else {
|
|
1136
|
+
lines.push(`${display} ${itemLabel} ${cyan(style, timelineGraph(idx))} ${stageWord}`);
|
|
1137
|
+
lines.push(` ${STAGES.join(" \u2192 ")}${idx === 4 ? " \u{1F389}" : ""}`);
|
|
1138
|
+
}
|
|
1135
1139
|
lines.push(` total ${cyan(style, total)}${taxSuffix(orderTaxInclusive)}`);
|
|
1136
1140
|
return {
|
|
1137
1141
|
lines,
|
|
1138
|
-
json: args.json ? { display_id: display, stage:
|
|
1142
|
+
json: args.json ? { display_id: display, stage: stageWord, total: o.total ?? null, currency: o.currency_code ?? null } : void 0
|
|
1139
1143
|
};
|
|
1140
1144
|
}
|
|
1141
1145
|
function registerOrder(program, makeClient2, loadConfig2) {
|
|
@@ -1192,16 +1196,8 @@ function registerToken(program) {
|
|
|
1192
1196
|
}
|
|
1193
1197
|
|
|
1194
1198
|
// src/commands/log-graph.ts
|
|
1195
|
-
function
|
|
1196
|
-
|
|
1197
|
-
if (status.includes("cancel") || status.includes("refund") || status.includes("revert")) {
|
|
1198
|
-
return "reverted";
|
|
1199
|
-
}
|
|
1200
|
-
const f = (o.fulfillment_status ?? "").toLowerCase();
|
|
1201
|
-
if (f.includes("delivered")) return "delivered";
|
|
1202
|
-
if (f.includes("shipped")) return "shipped";
|
|
1203
|
-
if (f.includes("fulfilled") || f.includes("printed") || f.includes("partially")) return "printed";
|
|
1204
|
-
return "committed";
|
|
1199
|
+
function orderStage2(o) {
|
|
1200
|
+
return orderStage(o);
|
|
1205
1201
|
}
|
|
1206
1202
|
function shortHash(o) {
|
|
1207
1203
|
const seed = `${o.display_id ?? ""}:${o.created_at ?? ""}`;
|
|
@@ -1219,19 +1215,19 @@ function label(o) {
|
|
|
1219
1215
|
return `${first.title ?? "order"}${first.variant_title ? ` \xB7 ${first.variant_title}` : ""}`;
|
|
1220
1216
|
}
|
|
1221
1217
|
function hasLiveHead(orders) {
|
|
1222
|
-
return orders.some((o) =>
|
|
1218
|
+
return orders.some((o) => orderStage2(o) !== "reverted");
|
|
1223
1219
|
}
|
|
1224
1220
|
function renderOneline(orders, style) {
|
|
1225
1221
|
if (orders.length === 0) return [];
|
|
1226
1222
|
const live = hasLiveHead(orders);
|
|
1227
|
-
const headIdx = live ? orders.findIndex((o) =>
|
|
1223
|
+
const headIdx = live ? orders.findIndex((o) => orderStage2(o) !== "reverted") : -1;
|
|
1228
1224
|
const lines = [];
|
|
1229
1225
|
if (!live) {
|
|
1230
1226
|
lines.push(dim(style, "(detached HEAD) you have no committed fits. literally nothing to wear. we don't judge."));
|
|
1231
1227
|
}
|
|
1232
1228
|
orders.forEach((o, i) => {
|
|
1233
1229
|
const hash = shortHash(o);
|
|
1234
|
-
const stage =
|
|
1230
|
+
const stage = orderStage2(o);
|
|
1235
1231
|
const ref = i === headIdx ? "(HEAD -> main) " : "";
|
|
1236
1232
|
const tail = stage === "delivered" ? "delivered \u{1F389}" : stage;
|
|
1237
1233
|
lines.push(`${hash} ${ref}${label(o).padEnd(34)} ${tail}`);
|
|
@@ -1241,14 +1237,14 @@ function renderOneline(orders, style) {
|
|
|
1241
1237
|
function renderGraph(orders, style) {
|
|
1242
1238
|
if (orders.length === 0) return [];
|
|
1243
1239
|
const live = hasLiveHead(orders);
|
|
1244
|
-
const headIdx = live ? orders.findIndex((o) =>
|
|
1240
|
+
const headIdx = live ? orders.findIndex((o) => orderStage2(o) !== "reverted") : -1;
|
|
1245
1241
|
const lines = [];
|
|
1246
1242
|
if (!live) {
|
|
1247
1243
|
lines.push(dim(style, "(detached HEAD) no committed fits. literally nothing to wear. we don't judge."));
|
|
1248
1244
|
}
|
|
1249
1245
|
orders.forEach((o, i) => {
|
|
1250
1246
|
const hash = shortHash(o);
|
|
1251
|
-
const stage =
|
|
1247
|
+
const stage = orderStage2(o);
|
|
1252
1248
|
const ref = i === headIdx ? " (HEAD -> main)" : "";
|
|
1253
1249
|
const node = stage === "delivered" ? green(style, "*") : "*";
|
|
1254
1250
|
const tail = stage === "delivered" ? `${stage} ${green(style, "\u{1F389}")}` : stage;
|
|
@@ -1262,7 +1258,7 @@ function renderGraph(orders, style) {
|
|
|
1262
1258
|
function renderFlat(orders) {
|
|
1263
1259
|
return orders.map((o) => {
|
|
1264
1260
|
const display = String(o.display_id ?? "");
|
|
1265
|
-
return `${display.padEnd(8)} ${label(o).padEnd(36)} ${
|
|
1261
|
+
return `${display.padEnd(8)} ${label(o).padEnd(36)} ${orderStage2(o)}`;
|
|
1266
1262
|
});
|
|
1267
1263
|
}
|
|
1268
1264
|
|