@sorrell/cli-utilities 1.0.47 → 1.0.48

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.
@@ -7,12 +7,22 @@
7
7
  * to the user with consistent and aesthetic formatting.
8
8
  */
9
9
  import type { FormatRules, Formatter } from "./Format.Types.js";
10
+ /**
11
+ * Formats a given {@link DisplayText} `string` *and* equips it with the given {@link Url}
12
+ * to create a hyperlink.
13
+ *
14
+ * @param DisplayText - The given text to display for the hyperlink.
15
+ * @param Url - The given URL to which the {@link DisplayText} will link.
16
+ *
17
+ * @returns {string} A hyperlink of the given {@link DisplayText} that directs to the given {@link Url}.
18
+ */
19
+ export declare function Link(DisplayText: string, Url: string): string;
10
20
  /**
11
21
  * Formats a given {@link Message} as code.
12
22
  *
13
23
  * @param Message - The given message to format.
14
24
  *
15
- * @returns The given {@link Message}, formatted to convey that it is code.
25
+ * @returns {string} The given {@link Message}, formatted to convey that it is code.
16
26
  */
17
27
  export declare function Code(Message: string): string;
18
28
  /**
@@ -22,7 +32,7 @@ export declare function Code(Message: string): string;
22
32
  *
23
33
  * @param Path - The path to format.
24
34
  *
25
- * @returns The given {@link Path}, formatted to convey that it is a path.
35
+ * @returns {string} The given {@link Path}, formatted to convey that it is a path.
26
36
  */
27
37
  export declare function Path(Path: string): string;
28
38
  /**
@@ -31,7 +41,7 @@ export declare function Path(Path: string): string;
31
41
  * @param Message - The message to format.
32
42
  * @param Rules - The {@link FormatRules} describing the transformations that should be made.
33
43
  *
34
- * @returns The formatted {@link Message}, such that every matched substring in {@link Rules}
44
+ * @returns {string} The formatted {@link Message}, such that every matched substring in {@link Rules}
35
45
  * is formatted by the corresponding {@link Formatter}.
36
46
  */
37
47
  export declare function Format(Message: string, Rules: FormatRules): string;
@@ -43,7 +53,7 @@ export declare function Format(Message: string, Rules: FormatRules): string;
43
53
  * multiple {@link Rules} share a given key, then the respective formatter functions
44
54
  * will be composed in the order of the given {@link Rules} objects.
45
55
  *
46
- * @returns A function that will format the `Message` passed to it according to the
56
+ * @returns {Formatter} A function that will format the `Message` passed to it according to the
47
57
  * {@link Rules} passed to this function.
48
58
  */
49
59
  export declare function MakeFormatter(...Rules: [FormatRules] | Array<FormatRules>): Formatter;
@@ -1 +1 @@
1
- {"version":3,"file":"Format.d.ts","sourceRoot":"","sources":["../../Source/Format/Format.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAiBhE;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAClB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACnB,MAAM,CAYR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,KAAK,EAAE,CAAE,WAAW,CAAE,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,CAsCvF"}
1
+ {"version":3,"file":"Format.d.ts","sourceRoot":"","sources":["../../Source/Format/Format.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAkBhE;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAClB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACnB,MAAM,CAYR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,KAAK,EAAE,CAAE,WAAW,CAAE,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,CAsCvF"}
@@ -8,22 +8,35 @@
8
8
  */
9
9
  import Chalk from "chalk";
10
10
  import { ParseFormatRules } from "./Format.Internal.js";
11
+ import TerminalLink from "terminal-link";
11
12
  /**
12
13
  * The base function for all functions exported by this module.
13
14
  *
14
15
  * @param Message - The input of the function in which this is called.
15
16
  *
16
- * @returns The given {@link Message} with base formatting applied.
17
+ * @returns {string} The given {@link Message} with base formatting applied.
17
18
  */
18
19
  function FormatBase(Message) {
19
20
  return Chalk.reset(Message);
20
21
  }
22
+ /**
23
+ * Formats a given {@link DisplayText} `string` *and* equips it with the given {@link Url}
24
+ * to create a hyperlink.
25
+ *
26
+ * @param DisplayText - The given text to display for the hyperlink.
27
+ * @param Url - The given URL to which the {@link DisplayText} will link.
28
+ *
29
+ * @returns {string} A hyperlink of the given {@link DisplayText} that directs to the given {@link Url}.
30
+ */
31
+ export function Link(DisplayText, Url) {
32
+ return TerminalLink(FormatBase(Chalk.underline(Chalk.cyan(DisplayText))), Url);
33
+ }
21
34
  /**
22
35
  * Formats a given {@link Message} as code.
23
36
  *
24
37
  * @param Message - The given message to format.
25
38
  *
26
- * @returns The given {@link Message}, formatted to convey that it is code.
39
+ * @returns {string} The given {@link Message}, formatted to convey that it is code.
27
40
  */
28
41
  export function Code(Message) {
29
42
  return FormatBase(Chalk.red(Message));
@@ -35,7 +48,7 @@ export function Code(Message) {
35
48
  *
36
49
  * @param Path - The path to format.
37
50
  *
38
- * @returns The given {@link Path}, formatted to convey that it is a path.
51
+ * @returns {string} The given {@link Path}, formatted to convey that it is a path.
39
52
  */
40
53
  export function Path(Path) {
41
54
  return Code(Chalk.red(Path));
@@ -46,7 +59,7 @@ export function Path(Path) {
46
59
  * @param Message - The message to format.
47
60
  * @param Rules - The {@link FormatRules} describing the transformations that should be made.
48
61
  *
49
- * @returns The formatted {@link Message}, such that every matched substring in {@link Rules}
62
+ * @returns {string} The formatted {@link Message}, such that every matched substring in {@link Rules}
50
63
  * is formatted by the corresponding {@link Formatter}.
51
64
  */
52
65
  export function Format(Message, Rules) {
@@ -65,7 +78,7 @@ export function Format(Message, Rules) {
65
78
  * multiple {@link Rules} share a given key, then the respective formatter functions
66
79
  * will be composed in the order of the given {@link Rules} objects.
67
80
  *
68
- * @returns A function that will format the `Message` passed to it according to the
81
+ * @returns {Formatter} A function that will format the `Message` passed to it according to the
69
82
  * {@link Rules} passed to this function.
70
83
  */
71
84
  export function MakeFormatter(...Rules) {
@@ -1 +1 @@
1
- {"version":3,"file":"Format.js","sourceRoot":"","sources":["../../Source/Format/Format.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,OAAe;IAE/B,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAEhC,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY;IAE7B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAClB,OAAe,EACf,KAAkB;IAGlB,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAE9B,MAAM,WAAW,GAAsB,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE/D,KAAK,MAAM,CAAE,KAAK,EAAE,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,KAA2C;IAExE,kDAAkD;IAClD,SAAS,YAAY;QAEjB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EACtB,CAAC;YACG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,aAA0B,EAAE,YAAyB,EAAe,EAAE;YAEvF,MAAM,QAAQ,GAAgB,EAAE,GAAG,aAAa,EAAE,CAAC;YAEnD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAW,EAAQ,EAAE;gBAEpD,IAAI,GAAG,IAAI,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,SAAS,EAC1F,CAAC;oBACG,MAAM,gBAAgB,GAAc,aAAa,CAAC,GAAG,CAAC,CAAC;oBACvD,MAAM,eAAe,GAAc,YAAY,CAAC,GAAG,CAAC,CAAC;oBAErD,QAAQ,CAAC,GAAG,CAAC,GAAG,UAAS,OAAe;wBAEpC,OAAO,eAAe,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;oBACtD,CAAC,CAAC;gBACN,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACpB,CAAC,EAAE,EAAG,CAAC,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAgB,YAAY,EAAE,CAAC;IAE7C,OAAO,UAAS,OAAe;QAE3B,OAAO,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sorrell/cli-utilities",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "Utilities developing CLI tools with TypeScript.",
5
5
  "keywords": [
6
6
  "cli",
@@ -100,6 +100,7 @@
100
100
  "en-inflectors": "^1.0.12",
101
101
  "listr2": "^10.2.1",
102
102
  "node-pty": "^1.1.0",
103
- "ora": "^9.3.0"
103
+ "ora": "^9.3.0",
104
+ "terminal-link": "5.0.0"
104
105
  }
105
106
  }