1 | # Installation
|
2 | > `npm install --save @types/shell-quote`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for shell-quote (https://github.com/substack/node-shell-quote).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/shell-quote.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/shell-quote/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for shell-quote 1.7
|
12 | // Project: https://github.com/substack/node-shell-quote
|
13 | // Definitions by: Jason Cheatham <https://github.com/jason0x43>
|
14 | // Cameron Diver <https://github.com/CameronDiver>
|
15 | // Opportunity Liu <https://github.com/OpportunityLiu>
|
16 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
17 | // TypeScript Version: 2.2
|
18 |
|
19 | export type ControlOperator = '||' | '&&' | ';;' | '|&' | '<(' | '>>' | '>&' | '&' | ';' | '(' | ')' | '|' | '<' | '>';
|
20 |
|
21 | export type ParseEntry =
|
22 | | string
|
23 | | { op: ControlOperator }
|
24 | | { op: 'glob'; pattern: string }
|
25 | | { comment: string };
|
26 |
|
27 | export interface ParseOptions {
|
28 | /**
|
29 | * Custom escape character, default value is `\`
|
30 | */
|
31 | escape?: string | undefined;
|
32 | }
|
33 |
|
34 | /**
|
35 | * Return a quoted string for the array `args` suitable for using in shell commands.
|
36 | */
|
37 | export function quote(args: ReadonlyArray<string>): string;
|
38 |
|
39 | /**
|
40 | * Return an array of arguments from the quoted string `cmd`.
|
41 | *
|
42 | * Interpolate embedded bash-style `$VARNAME` and `${VARNAME}` variables with the `env` object which like bash will replace undefined variables with `""`.
|
43 | */
|
44 | export function parse(
|
45 | cmd: string,
|
46 | env?: { readonly [key: string]: string | undefined },
|
47 | opts?: ParseOptions,
|
48 | ): ParseEntry[];
|
49 |
|
50 | /**
|
51 | * Return an array of arguments from the quoted string `cmd`.
|
52 | *
|
53 | * Interpolate embedded bash-style `$VARNAME` and `${VARNAME}` variables
|
54 | * with the `env` object which like bash will replace undefined variables with `""`.
|
55 | *
|
56 | * @param env
|
57 | * A function to perform lookups.
|
58 | * When env(key) returns a string, its result will be output just like env[key] would.
|
59 | * When env(key) returns an object, it will be inserted into the result array like the operator objects.
|
60 | */
|
61 | export function parse<T extends object | string>(
|
62 | cmd: string,
|
63 | env: (key: string) => T | undefined,
|
64 | opts?: ParseOptions,
|
65 | ): Array<ParseEntry | T>;
|
66 |
|
67 | ````
|
68 |
|
69 | ### Additional Details
|
70 | * Last updated: Tue, 06 Jul 2021 16:34:42 GMT
|
71 | * Dependencies: none
|
72 | * Global values: none
|
73 |
|
74 | # Credits
|
75 | These definitions were written by [Jason Cheatham](https://github.com/jason0x43), [Cameron Diver](https://github.com/CameronDiver), and [Opportunity Liu](https://github.com/OpportunityLiu).
|
76 |
|
\ | No newline at end of file |