Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 5d2495b

Browse files
committed
Use a shorter url for query details
1 parent bb46f66 commit 5d2495b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/subcommands/explain/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { EXIT_STATUS } from "../../constants";
88
import { KmdrAuthError } from "../../errors";
99
import { GetProgramAstResponse, SaveFeedbackResponse } from "../../interfaces";
1010
import Print from "../../Print";
11+
import chalk from "chalk";
1112

1213
interface ExplainInputQuery {
1314
source: string;
@@ -78,7 +79,8 @@ export default class Explain extends CLI {
7879

7980
Print.newLine();
8081

81-
Print.text(`Learn more at ${this.KMDR_WEBAPP_URI}/history/${commandId}`);
82+
const detailsUrl = this.detailsURL(commandId);
83+
Print.text(`Open in browser ${detailsUrl}`);
8284
Print.newLine();
8385

8486
// what do you want to do next?
@@ -242,4 +244,13 @@ export default class Explain extends CLI {
242244

243245
return source;
244246
}
247+
248+
private detailsURL(id: string) {
249+
const url =
250+
this.NODE_ENV === "production"
251+
? `https://h.kmdr.sh/${id}`
252+
: `${this.KMDR_WEBAPP_URI}/history/${id}`;
253+
254+
return chalk.blueBright.bold.underline(url);
255+
}
245256
}

0 commit comments

Comments
 (0)