@sorrell/cli-utilities 1.0.22 → 1.0.23
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/Distribution/Confirm.Types.d.ts +1 -0
- package/Distribution/Confirm.Types.d.ts.map +1 -1
- package/Distribution/Confirm.d.ts +7 -1
- package/Distribution/Confirm.d.ts.map +1 -1
- package/Distribution/Confirm.js +13 -2
- package/Distribution/Confirm.js.map +1 -1
- package/Distribution/Print/Print.Internal.Types.d.ts +4 -0
- package/Distribution/Print/Print.Internal.Types.d.ts.map +1 -0
- package/Distribution/Print/Print.Internal.Types.js +7 -0
- package/Distribution/Print/Print.Internal.Types.js.map +1 -0
- package/Distribution/Print/Print.Internal.d.ts +14 -0
- package/Distribution/Print/Print.Internal.d.ts.map +1 -0
- package/Distribution/Print/Print.Internal.js +78 -0
- package/Distribution/Print/Print.Internal.js.map +1 -0
- package/Distribution/Print/Print.Types.d.ts +13 -0
- package/Distribution/Print/Print.Types.d.ts.map +1 -0
- package/Distribution/Print/Print.Types.js +7 -0
- package/Distribution/Print/Print.Types.js.map +1 -0
- package/Distribution/Print/Print.d.ts +30 -0
- package/Distribution/Print/Print.d.ts.map +1 -0
- package/Distribution/Print/Print.js +59 -0
- package/Distribution/Print/Print.js.map +1 -0
- package/Distribution/Print/index.d.ts +3 -0
- package/Distribution/Print/index.d.ts.map +1 -0
- package/Distribution/Print/index.js +8 -0
- package/Distribution/Print/index.js.map +1 -0
- package/Distribution/index.d.ts +1 -1
- package/Distribution/index.d.ts.map +1 -1
- package/Distribution/index.js +1 -1
- package/Distribution/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirm.Types.d.ts","sourceRoot":"","sources":["../Source/Confirm.Types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,cAAc,GACtB;IACI,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;CAC9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"Confirm.Types.d.ts","sourceRoot":"","sources":["../Source/Confirm.Types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,oDAAoD;AACpD,MAAM,MAAM,cAAc,GACtB;IACI,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;CAC9B,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { FConfirmConfig } from "./index.js";
|
|
2
2
|
import type { Prompt } from "@inquirer/type";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* An `inquirer` prompt identical to `confirm`, but with more natural handling of keypresses.
|
|
5
|
+
*
|
|
6
|
+
* @param config - The configuration for this prompt.
|
|
7
|
+
*
|
|
8
|
+
* @returns The `boolean` corresponding to the user's choice.
|
|
9
|
+
*/
|
|
4
10
|
export declare const Confirm: Prompt<boolean, FConfirmConfig>;
|
|
5
11
|
//# sourceMappingURL=Confirm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirm.d.ts","sourceRoot":"","sources":["../Source/Confirm.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Confirm.d.ts","sourceRoot":"","sources":["../Source/Confirm.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAa7C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,cAAc,CAwDnD,CAAC"}
|
package/Distribution/Confirm.js
CHANGED
|
@@ -4,17 +4,27 @@
|
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
import { createPrompt, isEnterKey, makeTheme, useKeypress, usePrefix, useState } from "@inquirer/core";
|
|
7
|
+
/**
|
|
8
|
+
* @param Value - The answer.
|
|
9
|
+
* @returns The string to display for the given answer.
|
|
10
|
+
*/
|
|
7
11
|
function GetAnswerString(Value) {
|
|
8
12
|
return Value ? "Yes" : "No";
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
15
|
+
/**
|
|
16
|
+
* An `inquirer` prompt identical to `confirm`, but with more natural handling of keypresses.
|
|
17
|
+
*
|
|
18
|
+
* @param config - The configuration for this prompt.
|
|
19
|
+
*
|
|
20
|
+
* @returns The `boolean` corresponding to the user's choice.
|
|
21
|
+
*/
|
|
11
22
|
export const Confirm = createPrompt((Configuration, Done) => {
|
|
12
23
|
const [status, SetStatus] = useState("idle");
|
|
13
24
|
const [DisplayValue, SetDisplayValue] = useState("");
|
|
14
25
|
const theme = makeTheme(Configuration.theme);
|
|
15
26
|
const Prefix = usePrefix({ status, theme });
|
|
16
27
|
useKeypress((Key) => {
|
|
17
|
-
console.log("KeypressEvent is: ", JSON.stringify(Key, null, 4));
|
|
18
28
|
if (status !== "idle") {
|
|
19
29
|
return;
|
|
20
30
|
}
|
|
@@ -50,4 +60,5 @@ export const Confirm = createPrompt((Configuration, Done) => {
|
|
|
50
60
|
DisplayValue
|
|
51
61
|
].join("");
|
|
52
62
|
});
|
|
63
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
53
64
|
//# sourceMappingURL=Confirm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confirm.js","sourceRoot":"","sources":["../Source/Confirm.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIH,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAIrC,SAAS,eAAe,CAAC,KAAc;IAEnC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"Confirm.js","sourceRoot":"","sources":["../Source/Confirm.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIH,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAIrC;;;GAGG;AACH,SAAS,eAAe,CAAC,KAAc;IAEnC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,CAAC;AAED,wCAAwC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAoC,YAAY,CAChE,CAAC,aAA6B,EAAE,IAAgC,EAAE,EAAE;IAEhE,MAAM,CAAE,MAAM,EAAE,SAAS,CAAE,GAAG,QAAQ,CAAS,MAAM,CAAC,CAAC;IACvD,MAAM,CAAE,YAAY,EAAE,eAAe,CAAE,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvD,MAAM,KAAK,GAAU,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,MAAM,GAAW,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAEpD,WAAW,CAAC,CAAC,GAAkB,EAAE,EAAE;QAE/B,IAAI,MAAM,KAAK,MAAM,EACrB,CAAC;YACG,OAAO;QACX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,CAAC;AAEF,uCAAuC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.Internal.Types.d.ts","sourceRoot":"","sources":["../../Source/Print/Print.Internal.Types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.Internal.Types.js","sourceRoot":"","sources":["../../Source/Print/Print.Internal.Types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FormatRules } from "./Print.Types.js";
|
|
2
|
+
import type { FormatRulesParsed } from "./Print.Internal.Types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parse a given {@link FormatRules} object into a `Map`, such that
|
|
5
|
+
* the keys of the given {@link Rules} that describe regular expressions
|
|
6
|
+
* are replaced by the `RegExp` objects that they describe. Keys that
|
|
7
|
+
* correspond to substrings are left as-is.
|
|
8
|
+
*
|
|
9
|
+
* @param Rules - The given {@link FormatRules} to parse.
|
|
10
|
+
*
|
|
11
|
+
* @returns The parsed {@link FormatRules}, as a {@link FormatRulesParsed} `Map`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ParseFormatRules(Rules: FormatRules): FormatRulesParsed;
|
|
14
|
+
//# sourceMappingURL=Print.Internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.Internal.d.ts","sourceRoot":"","sources":["../../Source/Print/Print.Internal.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAkFnE;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAatE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* File: Print.Internal.ts
|
|
2
|
+
* Author: Gage Sorrell <gage@sorrell.sh>
|
|
3
|
+
* Copyright: (c) 2026 Gage Sorrell
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @param Value - The given string to parse.
|
|
8
|
+
* @returns The parsed string or regular expression.
|
|
9
|
+
*/
|
|
10
|
+
function ParseStringOrRegularExpression(Value) {
|
|
11
|
+
if (Value.length < 2) {
|
|
12
|
+
return Value;
|
|
13
|
+
}
|
|
14
|
+
if (Value[0] !== "/") {
|
|
15
|
+
return Value;
|
|
16
|
+
}
|
|
17
|
+
const ClosingSlashIndex = GetClosingSlashIndex(Value);
|
|
18
|
+
if (ClosingSlashIndex <= 0) {
|
|
19
|
+
return Value;
|
|
20
|
+
}
|
|
21
|
+
const Pattern = Value.slice(1, ClosingSlashIndex);
|
|
22
|
+
const Flags = Value.slice(ClosingSlashIndex + 1);
|
|
23
|
+
try {
|
|
24
|
+
return new RegExp(Pattern, Flags);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return Value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @param Value - The given `string` whose index of a closing slash is returned.
|
|
32
|
+
* @returns The index of the closing slash in the given `string`, or `-1` if there is no closing slash.
|
|
33
|
+
*/
|
|
34
|
+
function GetClosingSlashIndex(Value) {
|
|
35
|
+
for (let Index = Value.length - 1; Index >= 1; Index--) {
|
|
36
|
+
if (Value[Index] !== "/") {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (!IsCharacterEscaped(Value, Index)) {
|
|
40
|
+
return Index;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return -1;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @param Value - The given `string` in which to check whether the character at the given `index` is escaped.
|
|
47
|
+
* @param Index - The index of the character to check.
|
|
48
|
+
* @returns Whether the given {@link Value} is escaped at the given {@link Index}.
|
|
49
|
+
*/
|
|
50
|
+
function IsCharacterEscaped(Value, Index) {
|
|
51
|
+
let BackslashCount = 0;
|
|
52
|
+
for (let CurrentIndex = Index - 1; CurrentIndex >= 0; CurrentIndex--) {
|
|
53
|
+
if (Value[CurrentIndex] !== "\\") {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
BackslashCount++;
|
|
57
|
+
}
|
|
58
|
+
return (BackslashCount % 2) === 1;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parse a given {@link FormatRules} object into a `Map`, such that
|
|
62
|
+
* the keys of the given {@link Rules} that describe regular expressions
|
|
63
|
+
* are replaced by the `RegExp` objects that they describe. Keys that
|
|
64
|
+
* correspond to substrings are left as-is.
|
|
65
|
+
*
|
|
66
|
+
* @param Rules - The given {@link FormatRules} to parse.
|
|
67
|
+
*
|
|
68
|
+
* @returns The parsed {@link FormatRules}, as a {@link FormatRulesParsed} `Map`.
|
|
69
|
+
*/
|
|
70
|
+
export function ParseFormatRules(Rules) {
|
|
71
|
+
const Out = new Map();
|
|
72
|
+
Object.entries(Rules).forEach(([Key, Formatter]) => {
|
|
73
|
+
const ParsedKey = ParseStringOrRegularExpression(Key);
|
|
74
|
+
Out.set(ParsedKey, Formatter);
|
|
75
|
+
});
|
|
76
|
+
return Out;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=Print.Internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.Internal.js","sourceRoot":"","sources":["../../Source/Print/Print.Internal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;GAGG;AACH,SAAS,8BAA8B,CAAC,KAAa;IAEjD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EACpB,CAAC;QACG,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IA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AC;IACrB,CAAC;IAED,OAAO,CAAC,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAkB;IAE/C,MAAM,GAAG,GAAoC,IAAI,GAAG,EAA8B,CAAC;IAInF,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,GAAG,EAAE,SAAS,CAAS,EAAQ,EAAE;QAE9D,MAAM,SAAS,GAAoB,8BAA8B,CAAC,GAAG,CAAC,CAAC;QACvE,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function that formats a given {@link Message | Message string}.
|
|
3
|
+
*
|
|
4
|
+
* @param Message - The given message to format.
|
|
5
|
+
*
|
|
6
|
+
* @returns The formatted message.
|
|
7
|
+
*/
|
|
8
|
+
export type Formatter = {
|
|
9
|
+
(Message: string): string;
|
|
10
|
+
};
|
|
11
|
+
/** A mapping of substrings or regular expressions to {@link Formatter | Formatters}. */
|
|
12
|
+
export type FormatRules = Record<string, Formatter>;
|
|
13
|
+
//# sourceMappingURL=Print.Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.Types.d.ts","sourceRoot":"","sources":["../../Source/Print/Print.Types.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GACjB;IACI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAEN,wFAAwF;AACxF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.Types.js","sourceRoot":"","sources":["../../Source/Print/Print.Types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FormatRules } from "./Print.Types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Formats a given {@link Message} as code.
|
|
4
|
+
*
|
|
5
|
+
* @param Message - The given message to format.
|
|
6
|
+
*
|
|
7
|
+
* @returns The given {@link Message}, formatted to convey that it is code.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Code(Message: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Formats a given {@link Path} as a path.
|
|
12
|
+
*
|
|
13
|
+
* @note Currently, this is just an alias for {@link Code}.
|
|
14
|
+
*
|
|
15
|
+
* @param Path - The path to format.
|
|
16
|
+
*
|
|
17
|
+
* @returns The given {@link Path}, formatted to convey that it is a path.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Path(Path: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Format a given {@link Message} according to the given {@link Rules}.
|
|
22
|
+
*
|
|
23
|
+
* @param Message - The message to format.
|
|
24
|
+
* @param Rules - The {@link FormatRules} describing the transformations that should be made.
|
|
25
|
+
*
|
|
26
|
+
* @returns The formatted {@link Message}, such that every matched substring in {@link Rules}
|
|
27
|
+
* is formatted by the corresponding {@link Formatter}.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Format(Message: string, Rules: FormatRules): string;
|
|
30
|
+
//# sourceMappingURL=Print.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.d.ts","sourceRoot":"","sources":["../../Source/Print/Print.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgBpD;;;;;;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,GAAG,MAAM,CAY9B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* File: Print.ts
|
|
2
|
+
* Author: Gage Sorrell <gage@sorrell.sh>
|
|
3
|
+
* Copyright: (c) 2026 Gage Sorrell
|
|
4
|
+
* License: MIT
|
|
5
|
+
* Comment: This module contains functions to output messages
|
|
6
|
+
* to the user with consistent and aesthetic formatting.
|
|
7
|
+
*/
|
|
8
|
+
import Chalk from "chalk";
|
|
9
|
+
import { ParseFormatRules } from "./Print.Internal.js";
|
|
10
|
+
/**
|
|
11
|
+
* The base function for all functions exported by this module.
|
|
12
|
+
*
|
|
13
|
+
* @param Message - The input of the function in which this is called.
|
|
14
|
+
*
|
|
15
|
+
* @returns The given {@link Message} with base formatting applied.
|
|
16
|
+
*/
|
|
17
|
+
function FormatBase(Message) {
|
|
18
|
+
return Chalk.reset(Message);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Formats a given {@link Message} as code.
|
|
22
|
+
*
|
|
23
|
+
* @param Message - The given message to format.
|
|
24
|
+
*
|
|
25
|
+
* @returns The given {@link Message}, formatted to convey that it is code.
|
|
26
|
+
*/
|
|
27
|
+
export function Code(Message) {
|
|
28
|
+
return FormatBase(Chalk.red(Message));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Formats a given {@link Path} as a path.
|
|
32
|
+
*
|
|
33
|
+
* @note Currently, this is just an alias for {@link Code}.
|
|
34
|
+
*
|
|
35
|
+
* @param Path - The path to format.
|
|
36
|
+
*
|
|
37
|
+
* @returns The given {@link Path}, formatted to convey that it is a path.
|
|
38
|
+
*/
|
|
39
|
+
export function Path(Path) {
|
|
40
|
+
return Code(Chalk.red(Path));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Format a given {@link Message} according to the given {@link Rules}.
|
|
44
|
+
*
|
|
45
|
+
* @param Message - The message to format.
|
|
46
|
+
* @param Rules - The {@link FormatRules} describing the transformations that should be made.
|
|
47
|
+
*
|
|
48
|
+
* @returns The formatted {@link Message}, such that every matched substring in {@link Rules}
|
|
49
|
+
* is formatted by the corresponding {@link Formatter}.
|
|
50
|
+
*/
|
|
51
|
+
export function Format(Message, Rules) {
|
|
52
|
+
Message = FormatBase(Message);
|
|
53
|
+
const RulesParsed = ParseFormatRules(Rules);
|
|
54
|
+
for (const [Match, Formatter] of RulesParsed) {
|
|
55
|
+
Message = Message.replaceAll(Match, Formatter);
|
|
56
|
+
}
|
|
57
|
+
return Message;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=Print.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Print.js","sourceRoot":"","sources":["../../Source/Print/Print.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;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;IAElB,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAE9B,MAAM,WAAW,GAAsB,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE/D,KAAK,MAAM,CAAE,KAAK,EAAE,SAAS,CAAE,IAAI,WAAW,EAC9C,CAAC;QACG,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Source/Print/index.ts"],"names":[],"mappings":"AAMA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Source/Print/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
package/Distribution/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAMA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAMA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC"}
|
package/Distribution/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sorrell/cli-utilities",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Utilities for CLI tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"ora",
|
|
13
13
|
"commander"
|
|
14
14
|
],
|
|
15
|
-
"homepage": "https://github.com/GageSorrell/SorrellWm
|
|
15
|
+
"homepage": "https://github.com/GageSorrell/SorrellWm/tree/Master/Package/CliUtilities",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/GageSorrell/SorrellWm/issues"
|
|
18
18
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@inquirer/core": "^11.1.7",
|
|
37
37
|
"@inquirer/prompts": "^8.3.2",
|
|
38
38
|
"@inquirer/type": "^4.0.4",
|
|
39
|
-
"@sorrell/inquirer-file-selector": "^1.0.
|
|
39
|
+
"@sorrell/inquirer-file-selector": "^1.0.4",
|
|
40
40
|
"chalk": "^5.6.2",
|
|
41
41
|
"cli-table3": "^0.6.5",
|
|
42
42
|
"clipboardy": "^5.3.1",
|