@sorrell/cli-utilities 1.0.37 → 1.0.39
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/Command/Command.d.ts +33 -0
- package/Distribution/Command/Command.d.ts.map +1 -0
- package/Distribution/Command/Command.js +37 -0
- package/Distribution/Command/Command.js.map +1 -0
- package/Distribution/Command/index.d.ts +8 -0
- package/Distribution/Command/index.d.ts.map +1 -0
- package/Distribution/Command/index.js +8 -0
- package/Distribution/Command/index.js.map +1 -0
- package/Distribution/PseudoTerminal/PseudoTerminal.d.ts.map +1 -1
- package/Distribution/PseudoTerminal/PseudoTerminal.js +2 -1
- package/Distribution/PseudoTerminal/PseudoTerminal.js.map +1 -1
- package/Distribution/index.d.ts +2 -0
- package/Distribution/index.d.ts.map +1 -1
- package/Distribution/index.js +2 -0
- package/Distribution/index.js.map +1 -1
- package/package.json +7 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Command.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* For a given command, get the name of that command, such that it will
|
|
9
|
+
* work, even if the command will be run inside of a Windows shell terminal.
|
|
10
|
+
*
|
|
11
|
+
* @note The {@link process!platform} is used to determine whether `.cmd`
|
|
12
|
+
* should be appended.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} PlainName - The name of the command, without `.cmd` appended.
|
|
15
|
+
* @returns {string} The command, with `.cmd` appended, if needed.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* Suppose that the following code belongs to a script that is being run within
|
|
19
|
+
* a Windows shell terminal,
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const MyCommand: string = GetCommandName("MyCommand");
|
|
22
|
+
* // `MyCommand` <- `"MyCommand.cmd"`
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Now suppose that the following code belongs to a script that is *not* being run
|
|
26
|
+
* within a Windows shell terminal,
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const MyCommand: string = GetCommandName("MyCommand");
|
|
29
|
+
* // `MyCommand` <- `"MyCommand"`
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function GetCommandName(PlainName: string): string;
|
|
33
|
+
//# sourceMappingURL=Command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../Source/Command/Command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKxD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Command.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* For a given command, get the name of that command, such that it will
|
|
9
|
+
* work, even if the command will be run inside of a Windows shell terminal.
|
|
10
|
+
*
|
|
11
|
+
* @note The {@link process!platform} is used to determine whether `.cmd`
|
|
12
|
+
* should be appended.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} PlainName - The name of the command, without `.cmd` appended.
|
|
15
|
+
* @returns {string} The command, with `.cmd` appended, if needed.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* Suppose that the following code belongs to a script that is being run within
|
|
19
|
+
* a Windows shell terminal,
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const MyCommand: string = GetCommandName("MyCommand");
|
|
22
|
+
* // `MyCommand` <- `"MyCommand.cmd"`
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Now suppose that the following code belongs to a script that is *not* being run
|
|
26
|
+
* within a Windows shell terminal,
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const MyCommand: string = GetCommandName("MyCommand");
|
|
29
|
+
* // `MyCommand` <- `"MyCommand"`
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export function GetCommandName(PlainName) {
|
|
33
|
+
return process.platform === "win32"
|
|
34
|
+
? `${PlainName}.cmd`
|
|
35
|
+
: PlainName;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=Command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../Source/Command/Command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAE5C,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO;QAC/B,CAAC,CAAC,GAAI,SAAU,MAAM;QACtB,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Source/Command/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Source/Command/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PseudoTerminal.d.ts","sourceRoot":"","sources":["../../Source/PseudoTerminal/PseudoTerminal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAS,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"PseudoTerminal.d.ts","sourceRoot":"","sources":["../../Source/PseudoTerminal/PseudoTerminal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAS,MAAM,UAAU,CAAC;AAG/F,wBAAgB,KAAK,CACjB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EACxB,OAAO,EAAE,eAAe,GAAG,sBAAsB,GAClD,IAAI,CAsBN"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
import { spawn } from "node-pty";
|
|
8
|
+
import { GetCommandName } from "../Command/Command.js";
|
|
8
9
|
export function Spawn(Command, Arguments, Options) {
|
|
9
10
|
const DefaultOptions = {
|
|
10
11
|
cols: process.stdout.columns || 80,
|
|
@@ -17,6 +18,6 @@ export function Spawn(Command, Arguments, Options) {
|
|
|
17
18
|
...DefaultOptions,
|
|
18
19
|
...Options
|
|
19
20
|
};
|
|
20
|
-
return spawn(Command, Arguments, OutOptions);
|
|
21
|
+
return spawn(GetCommandName(Command), Arguments, OutOptions);
|
|
21
22
|
}
|
|
22
23
|
//# sourceMappingURL=PseudoTerminal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PseudoTerminal.js","sourceRoot":"","sources":["../../Source/PseudoTerminal/PseudoTerminal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAgE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"PseudoTerminal.js","sourceRoot":"","sources":["../../Source/PseudoTerminal/PseudoTerminal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAgE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,UAAU,KAAK,CACjB,OAAe,EACf,SAAwB,EACxB,OAAiD;IAGjD,MAAM,cAAc,GAChB;QACI,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE;QAClC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,GAAG,EAAE,OAAO,CAAC,GAA6B;QAC1C,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;KAClC,CAAC;IAEN,MAAM,UAAU,GACZ;QACI,GAAG,cAAc;QACjB,GAAG,OAAO;KACb,CAAC;IAEN,OAAO,KAAK,CACR,cAAc,CAAC,OAAO,CAAC,EACvB,SAAS,EACT,UAAU,CACb,CAAC;AACN,CAAC"}
|
package/Distribution/index.d.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
export * from "./Inquirer/Confirm.js";
|
|
8
|
+
export * as Command from "./Command/index.js";
|
|
8
9
|
export * as Listr from "./Listr/index.js";
|
|
9
10
|
export * as Inquirer from "./Inquirer/index.js";
|
|
11
|
+
export * as PseudoTerminal from "./PseudoTerminal/index.js";
|
|
10
12
|
export * as Format from "./Format/index.js";
|
|
11
13
|
export * as Ora from "./Ora/index.js";
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC"}
|
package/Distribution/index.js
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
export * from "./Inquirer/Confirm.js";
|
|
8
|
+
export * as Command from "./Command/index.js";
|
|
8
9
|
export * as Listr from "./Listr/index.js";
|
|
9
10
|
export * as Inquirer from "./Inquirer/index.js";
|
|
11
|
+
export * as PseudoTerminal from "./PseudoTerminal/index.js";
|
|
10
12
|
export * as Format from "./Format/index.js";
|
|
11
13
|
export * as Ora from "./Ora/index.js";
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../Source/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,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.39",
|
|
4
4
|
"description": "Utilities for CLI tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -46,6 +46,12 @@
|
|
|
46
46
|
"require": "./Distribution/Inquirer/index.js",
|
|
47
47
|
"types": "./Distribution/Inquirer/index.d.ts"
|
|
48
48
|
},
|
|
49
|
+
"./command": {
|
|
50
|
+
"default": "./Distribution/Command/index.js",
|
|
51
|
+
"import": "./Distribution/Command/index.js",
|
|
52
|
+
"require": "./Distribution/Command/index.js",
|
|
53
|
+
"types": "./Distribution/Command/index.d.ts"
|
|
54
|
+
},
|
|
49
55
|
"./listr": {
|
|
50
56
|
"default": "./Distribution/Listr/index.js",
|
|
51
57
|
"import": "./Distribution/Listr/index.js",
|