@settlemint/sdk-cli 1.0.8-pr06f14b9b → 1.0.8-pr0c78ff57
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/cli.js +73 -43
- package/dist/cli.js.map +7 -7
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -209465,7 +209465,7 @@ ${Bt.cyan(Yt)}
|
|
|
209465
209465
|
code: "ENOENT"
|
|
209466
209466
|
}), getPathInfo = (e9, t7) => {
|
|
209467
209467
|
var r6 = t7.colon || or;
|
|
209468
|
-
var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
209468
|
+
var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.ULcbrjr2bo:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
|
|
209469
209469
|
var n6 = nr ? t7.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
209470
209470
|
var a5 = nr ? n6.split(r6) : [""];
|
|
209471
209471
|
if (nr) {
|
|
@@ -212602,7 +212602,7 @@ ${whileRunning(e9)}`;
|
|
|
212602
212602
|
};
|
|
212603
212603
|
ni = Object.assign(async function _main() {
|
|
212604
212604
|
var e9 = new Cli({
|
|
212605
|
-
binaryVersion: "1.0.8-
|
|
212605
|
+
binaryVersion: "1.0.8-pr0c78ff57",
|
|
212606
212606
|
binaryLabel: "gql.tada CLI",
|
|
212607
212607
|
binaryName: "gql.tada"
|
|
212608
212608
|
});
|
|
@@ -220192,7 +220192,7 @@ var require_lib4 = __commonJS((exports, module) => {
|
|
|
220192
220192
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
220193
220193
|
var getNotFoundError2 = (cmd2) => Object.assign(new Error(`not found: ${cmd2}`), { code: "ENOENT" });
|
|
220194
220194
|
var getPathInfo2 = (cmd2, {
|
|
220195
|
-
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
220195
|
+
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.ULcbrjr2bo:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
220196
220196
|
pathExt: optPathExt = process.env.PATHEXT,
|
|
220197
220197
|
delimiter: optDelimiter = delimiter
|
|
220198
220198
|
}) => {
|
|
@@ -220396,7 +220396,7 @@ var require_lib5 = __commonJS((exports, module) => {
|
|
|
220396
220396
|
let pathToInitial;
|
|
220397
220397
|
try {
|
|
220398
220398
|
pathToInitial = which.sync(initialCmd, {
|
|
220399
|
-
path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
220399
|
+
path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.ULcbrjr2bo:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
220400
220400
|
pathext: options.env && findInObject(options.env, "PATHEXT") || process.env.PATHEXT
|
|
220401
220401
|
}).toLowerCase();
|
|
220402
220402
|
} catch (err) {
|
|
@@ -221113,7 +221113,7 @@ var require_lib6 = __commonJS((exports, module) => {
|
|
|
221113
221113
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
221114
221114
|
var getNotFoundError2 = (cmd2) => Object.assign(new Error(`not found: ${cmd2}`), { code: "ENOENT" });
|
|
221115
221115
|
var getPathInfo2 = (cmd2, {
|
|
221116
|
-
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
221116
|
+
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.ULcbrjr2bo:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
221117
221117
|
pathExt: optPathExt = process.env.PATHEXT,
|
|
221118
221118
|
delimiter: optDelimiter = delimiter
|
|
221119
221119
|
}) => {
|
|
@@ -234988,7 +234988,7 @@ var require_which2 = __commonJS((exports, module) => {
|
|
|
234988
234988
|
const colon = opt2.colon || COLON;
|
|
234989
234989
|
const pathEnv = cmd2.match(/\//) || isWindows2 && cmd2.match(/\\/) ? [""] : [
|
|
234990
234990
|
...isWindows2 ? [process.cwd()] : [],
|
|
234991
|
-
...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
234991
|
+
...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.ULcbrjr2bo:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
|
|
234992
234992
|
];
|
|
234993
234993
|
const pathExtExe = isWindows2 ? opt2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
234994
234994
|
const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
|
|
@@ -267180,11 +267180,13 @@ function mergeOthers(values, utils, meta) {
|
|
|
267180
267180
|
var maskTokens = (output) => {
|
|
267181
267181
|
return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
|
|
267182
267182
|
};
|
|
267183
|
+
var CancelError = class extends Error {
|
|
267184
|
+
};
|
|
267183
267185
|
var cancel = (msg) => {
|
|
267184
267186
|
console.log("");
|
|
267185
267187
|
console.log(inverse(redBright(maskTokens(msg))));
|
|
267186
267188
|
console.log("");
|
|
267187
|
-
|
|
267189
|
+
throw new CancelError(msg);
|
|
267188
267190
|
};
|
|
267189
267191
|
function validate(schema, value) {
|
|
267190
267192
|
try {
|
|
@@ -267481,11 +267483,13 @@ var ascii = () => console.log(magentaBright(`
|
|
|
267481
267483
|
var maskTokens2 = (output) => {
|
|
267482
267484
|
return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
|
|
267483
267485
|
};
|
|
267486
|
+
var CancelError2 = class extends Error {
|
|
267487
|
+
};
|
|
267484
267488
|
var cancel2 = (msg) => {
|
|
267485
267489
|
console.log("");
|
|
267486
267490
|
console.log(inverse(redBright(maskTokens2(msg))));
|
|
267487
267491
|
console.log("");
|
|
267488
|
-
|
|
267492
|
+
throw new CancelError2(msg);
|
|
267489
267493
|
};
|
|
267490
267494
|
async function executeCommand(command, args, options) {
|
|
267491
267495
|
const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
|
|
@@ -267562,10 +267566,11 @@ var spinner = async (options) => {
|
|
|
267562
267566
|
return result;
|
|
267563
267567
|
} catch (error) {
|
|
267564
267568
|
spinner2.error(redBright(`${options.startMessage} --> Error!`));
|
|
267565
|
-
|
|
267569
|
+
const errorMessage = maskTokens2(error.message);
|
|
267570
|
+
note(redBright(`${errorMessage}
|
|
267566
267571
|
|
|
267567
267572
|
${error.stack}`));
|
|
267568
|
-
|
|
267573
|
+
throw new Error(errorMessage);
|
|
267569
267574
|
}
|
|
267570
267575
|
};
|
|
267571
267576
|
function capitalizeFirstLetter(val) {
|
|
@@ -267601,7 +267606,7 @@ function table(title, data, compact = true) {
|
|
|
267601
267606
|
var package_default = {
|
|
267602
267607
|
name: "@settlemint/sdk-cli",
|
|
267603
267608
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
|
267604
|
-
version: "1.0.8-
|
|
267609
|
+
version: "1.0.8-pr0c78ff57",
|
|
267605
267610
|
type: "module",
|
|
267606
267611
|
private: false,
|
|
267607
267612
|
license: "FSL-1.1-MIT",
|
|
@@ -267657,8 +267662,8 @@ var package_default = {
|
|
|
267657
267662
|
"@inquirer/input": "4.1.3",
|
|
267658
267663
|
"@inquirer/password": "4.0.6",
|
|
267659
267664
|
"@inquirer/select": "4.0.6",
|
|
267660
|
-
"@settlemint/sdk-js": "1.0.8-
|
|
267661
|
-
"@settlemint/sdk-utils": "1.0.8-
|
|
267665
|
+
"@settlemint/sdk-js": "1.0.8-pr0c78ff57",
|
|
267666
|
+
"@settlemint/sdk-utils": "1.0.8-pr0c78ff57",
|
|
267662
267667
|
"get-tsconfig": "4.9.0",
|
|
267663
267668
|
giget: "1.2.3",
|
|
267664
267669
|
yaml: "2.7.0"
|
|
@@ -277500,13 +277505,18 @@ function subgraphCodegenCommand() {
|
|
|
277500
277505
|
import { dirname as dirname12 } from "node:path";
|
|
277501
277506
|
|
|
277502
277507
|
// src/prompts/smart-contract-set/subgraph-name.prompt.ts
|
|
277503
|
-
async function subgraphNamePrompt(
|
|
277504
|
-
|
|
277508
|
+
async function subgraphNamePrompt({
|
|
277509
|
+
defaultName,
|
|
277510
|
+
env: env2,
|
|
277511
|
+
accept,
|
|
277512
|
+
prod
|
|
277513
|
+
}) {
|
|
277514
|
+
const defaultSubgraphName = defaultName ? sanitizeName(defaultName) : undefined;
|
|
277505
277515
|
if (accept) {
|
|
277506
277516
|
if (defaultSubgraphName && env2.SETTLEMINT_THEGRAPH_SUBGRAPH_NAME !== defaultSubgraphName) {
|
|
277507
277517
|
await saveSubgraphName(defaultSubgraphName, env2, prod);
|
|
277508
277518
|
}
|
|
277509
|
-
return defaultSubgraphName;
|
|
277519
|
+
return defaultSubgraphName ?? env2.SETTLEMINT_THEGRAPH_SUBGRAPH_NAME;
|
|
277510
277520
|
}
|
|
277511
277521
|
const subgraphName = await esm_default4({
|
|
277512
277522
|
message: "What is the name of your subgraph?",
|
|
@@ -277514,7 +277524,7 @@ async function subgraphNamePrompt(defaultName, env2, accept, prod) {
|
|
|
277514
277524
|
required: true
|
|
277515
277525
|
});
|
|
277516
277526
|
const sanitizedSubgraphName = sanitizeName(subgraphName);
|
|
277517
|
-
if (
|
|
277527
|
+
if (env2.SETTLEMINT_THEGRAPH_SUBGRAPH_NAME !== sanitizedSubgraphName) {
|
|
277518
277528
|
await saveSubgraphName(sanitizedSubgraphName, env2, prod);
|
|
277519
277529
|
}
|
|
277520
277530
|
return sanitizedSubgraphName;
|
|
@@ -277570,7 +277580,12 @@ function subgraphDeployCommand() {
|
|
|
277570
277580
|
cancel2('The "subgraph/subgraph.config.json" config has not been set, ensure all the contracts listed have an address added');
|
|
277571
277581
|
}
|
|
277572
277582
|
}
|
|
277573
|
-
const graphName = await subgraphNamePrompt(
|
|
277583
|
+
const graphName = await subgraphNamePrompt({
|
|
277584
|
+
defaultName: subgraphName,
|
|
277585
|
+
env: env2,
|
|
277586
|
+
accept: autoAccept,
|
|
277587
|
+
prod: !!prod
|
|
277588
|
+
});
|
|
277574
277589
|
if (!graphName) {
|
|
277575
277590
|
cancel2("No graph name provided. Please provide a graph name to continue.");
|
|
277576
277591
|
}
|
|
@@ -277640,6 +277655,14 @@ function getCommandPath(command) {
|
|
|
277640
277655
|
}
|
|
277641
277656
|
return parts.join(" ");
|
|
277642
277657
|
}
|
|
277658
|
+
function getCommandPathFromArgv(argv) {
|
|
277659
|
+
const settlemintIndex = argv.indexOf("settlemint");
|
|
277660
|
+
const args = argv.slice(settlemintIndex !== -1 ? settlemintIndex + 1 : 0);
|
|
277661
|
+
if (!args.length) {
|
|
277662
|
+
return null;
|
|
277663
|
+
}
|
|
277664
|
+
return args.join(" ");
|
|
277665
|
+
}
|
|
277643
277666
|
function isLeafCommand(command) {
|
|
277644
277667
|
return command.commands.length === 0;
|
|
277645
277668
|
}
|
|
@@ -277647,18 +277670,20 @@ function isJsonOrYamlOutput(command) {
|
|
|
277647
277670
|
const options = command.opts();
|
|
277648
277671
|
return typeof options.output === "string" && (options.output === "json" || options.output === "yaml");
|
|
277649
277672
|
}
|
|
277650
|
-
function addHooksToCommand(cmd2, rootCmd) {
|
|
277673
|
+
function addHooksToCommand(cmd2, rootCmd, argv) {
|
|
277651
277674
|
const extendedCmd = cmd2;
|
|
277652
277675
|
extendedCmd.hook("preAction", async (thisCommand) => {
|
|
277676
|
+
if (isLeafCommand(thisCommand)) {
|
|
277677
|
+
const commandPath = getCommandPath(thisCommand);
|
|
277678
|
+
rootCmd._lastCommand = thisCommand;
|
|
277679
|
+
rootCmd._lastCommand._commandPath = commandPath;
|
|
277680
|
+
}
|
|
277653
277681
|
if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
|
|
277654
277682
|
ascii();
|
|
277655
277683
|
}
|
|
277656
|
-
const commandPath = getCommandPath(thisCommand);
|
|
277657
|
-
rootCmd._lastCommand = thisCommand;
|
|
277658
|
-
rootCmd._lastCommand._commandPath = commandPath;
|
|
277659
277684
|
}).hook("postAction", async (thisCommand) => {
|
|
277660
277685
|
if (isLeafCommand(thisCommand)) {
|
|
277661
|
-
const commandPath =
|
|
277686
|
+
const commandPath = thisCommand._commandPath ?? getCommandPathFromArgv(argv);
|
|
277662
277687
|
if (commandPath) {
|
|
277663
277688
|
await telemetry({
|
|
277664
277689
|
command: commandPath,
|
|
@@ -277668,14 +277693,22 @@ function addHooksToCommand(cmd2, rootCmd) {
|
|
|
277668
277693
|
}
|
|
277669
277694
|
});
|
|
277670
277695
|
for (const subcmd of cmd2.commands) {
|
|
277671
|
-
addHooksToCommand(subcmd, rootCmd);
|
|
277696
|
+
addHooksToCommand(subcmd, rootCmd, argv);
|
|
277672
277697
|
}
|
|
277673
277698
|
}
|
|
277674
|
-
function
|
|
277675
|
-
const
|
|
277676
|
-
if (
|
|
277677
|
-
|
|
277699
|
+
async function onError(sdkcli, argv, error5) {
|
|
277700
|
+
const commandPath = sdkcli._lastCommand?._commandPath ?? getCommandPathFromArgv(argv);
|
|
277701
|
+
if (commandPath) {
|
|
277702
|
+
await telemetry({
|
|
277703
|
+
command: commandPath,
|
|
277704
|
+
status: "error",
|
|
277705
|
+
message: error5.message
|
|
277706
|
+
});
|
|
277678
277707
|
}
|
|
277708
|
+
process.exit(1);
|
|
277709
|
+
}
|
|
277710
|
+
function registerCommands() {
|
|
277711
|
+
const sdkcli = new Command;
|
|
277679
277712
|
sdkcli.name("settlemint").usage("[command]").description(`CLI for SettleMint (v${package_default.version})`).version(package_default.version, "-v, --version", "Output the current version").helpOption("-h, --help", "Display help for command").allowUnknownOption().showSuggestionAfterError(true).showHelpAfterError();
|
|
277680
277713
|
sdkcli.addCommand(connectCommand());
|
|
277681
277714
|
sdkcli.addCommand(codegenCommand());
|
|
@@ -277684,26 +277717,23 @@ function sdkCliCommand(exitOverride = undefined) {
|
|
|
277684
277717
|
sdkcli.addCommand(createCommand2());
|
|
277685
277718
|
sdkcli.addCommand(loginCommand());
|
|
277686
277719
|
sdkcli.addCommand(logoutCommand());
|
|
277720
|
+
return sdkcli;
|
|
277721
|
+
}
|
|
277722
|
+
async function sdkCliCommand(argv = process.argv) {
|
|
277723
|
+
const sdkcli = registerCommands();
|
|
277724
|
+
sdkcli.exitOverride((error5) => onError(sdkcli, argv, error5));
|
|
277687
277725
|
for (const cmd2 of sdkcli.commands) {
|
|
277688
|
-
addHooksToCommand(cmd2, sdkcli);
|
|
277726
|
+
addHooksToCommand(cmd2, sdkcli, argv);
|
|
277689
277727
|
}
|
|
277690
|
-
|
|
277691
|
-
sdkcli.parseAsync(
|
|
277692
|
-
|
|
277693
|
-
|
|
277694
|
-
|
|
277695
|
-
command: commandPath,
|
|
277696
|
-
status: "error",
|
|
277697
|
-
message: error5.message
|
|
277698
|
-
});
|
|
277699
|
-
}
|
|
277700
|
-
cancel2(error5.message);
|
|
277701
|
-
});
|
|
277728
|
+
try {
|
|
277729
|
+
await sdkcli.parseAsync(argv);
|
|
277730
|
+
} catch (err) {
|
|
277731
|
+
const error5 = err;
|
|
277732
|
+
onError(sdkcli, argv, error5);
|
|
277702
277733
|
}
|
|
277703
|
-
return sdkcli;
|
|
277704
277734
|
}
|
|
277705
277735
|
|
|
277706
277736
|
// src/cli.ts
|
|
277707
277737
|
sdkCliCommand();
|
|
277708
277738
|
|
|
277709
|
-
//# debugId=
|
|
277739
|
+
//# debugId=C10E8A88D62779C164756E2164756E21
|