@sorrell/cli-utilities 1.0.38 → 1.0.40
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.
|
@@ -5,5 +5,21 @@
|
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
import { type IPty, type IPtyForkOptions, type IWindowsPtyForkOptions } from "node-pty";
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* This function wraps {@link spawn} and provides sensible default options.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} Command - The name of the command to run.
|
|
12
|
+
* @param {Array<string>} Arguments - The arguments to supply with the {@link Command}.
|
|
13
|
+
* @param {IPtyForkOptions | IWindowsPtyForkOptions} Options - The options for the resulting
|
|
14
|
+
* `node-pty` session.
|
|
15
|
+
*
|
|
16
|
+
* @returns {IPty} The session
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* Running `npm install @sorrell/cli-utilities` via a `node-pty` session,
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const MySession: IPty = Spawn("npm", [ "install" ]);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function Spawn(Command: string, Arguments?: Array<string>, Options?: IPtyForkOptions | IWindowsPtyForkOptions): IPty;
|
|
9
25
|
//# sourceMappingURL=PseudoTerminal.d.ts.map
|
|
@@ -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;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CACjB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,KAAK,CAAC,MAAM,CAAO,EAC9B,OAAO,GAAE,eAAe,GAAG,sBAA4B,GACxD,IAAI,CAsBN"}
|
|
@@ -5,7 +5,24 @@
|
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
7
|
import { spawn } from "node-pty";
|
|
8
|
-
|
|
8
|
+
import { GetCommandName } from "../Command/Command.js";
|
|
9
|
+
/**
|
|
10
|
+
* This function wraps {@link spawn} and provides sensible default options.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} Command - The name of the command to run.
|
|
13
|
+
* @param {Array<string>} Arguments - The arguments to supply with the {@link Command}.
|
|
14
|
+
* @param {IPtyForkOptions | IWindowsPtyForkOptions} Options - The options for the resulting
|
|
15
|
+
* `node-pty` session.
|
|
16
|
+
*
|
|
17
|
+
* @returns {IPty} The session
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* Running `npm install @sorrell/cli-utilities` via a `node-pty` session,
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const MySession: IPty = Spawn("npm", [ "install" ]);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function Spawn(Command, Arguments = [], Options = {}) {
|
|
9
26
|
const DefaultOptions = {
|
|
10
27
|
cols: process.stdout.columns || 80,
|
|
11
28
|
cwd: process.cwd(),
|
|
@@ -17,6 +34,6 @@ export function Spawn(Command, Arguments, Options) {
|
|
|
17
34
|
...DefaultOptions,
|
|
18
35
|
...Options
|
|
19
36
|
};
|
|
20
|
-
return spawn(Command, Arguments, OutOptions);
|
|
37
|
+
return spawn(GetCommandName(Command), Arguments, OutOptions);
|
|
21
38
|
}
|
|
22
39
|
//# 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;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,KAAK,CACjB,OAAe,EACf,YAA2B,EAAG,EAC9B,UAAoD,EAAG;IAGvD,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"}
|