ssh-config 5.0.3 → 5.1.0

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.
@@ -1,99 +0,0 @@
1
- export declare enum LineType {
2
- DIRECTIVE = 1,
3
- COMMENT = 2
4
- }
5
- export type Separator = ' ' | '=' | '\t';
6
- export interface Directive {
7
- type: LineType.DIRECTIVE;
8
- before: string;
9
- after: string;
10
- param: string;
11
- separator: Separator;
12
- value: string | {
13
- val: string;
14
- separator: string;
15
- quoted?: boolean;
16
- }[];
17
- quoted?: boolean;
18
- }
19
- export interface Section extends Directive {
20
- config: SSHConfig;
21
- }
22
- export interface Match extends Section {
23
- criteria: Record<string, string | {
24
- val: string;
25
- separator: string;
26
- quoted?: boolean;
27
- }[]>;
28
- }
29
- export interface Comment {
30
- type: LineType.COMMENT;
31
- before: string;
32
- after: string;
33
- content: string;
34
- }
35
- export type Line = Match | Section | Directive | Comment;
36
- export interface FindOptions {
37
- Host?: string;
38
- }
39
- export interface MatchOptions {
40
- Host: string;
41
- User?: string;
42
- }
43
- export default class SSHConfig extends Array<Line> {
44
- static readonly DIRECTIVE: LineType.DIRECTIVE;
45
- static readonly COMMENT: LineType.COMMENT;
46
- /**
47
- * Parse SSH config text into structured object.
48
- */
49
- static parse(text: string): SSHConfig;
50
- /**
51
- * Stringify structured object into SSH config text.
52
- */
53
- static stringify(config: SSHConfig): string;
54
- /**
55
- * Query SSH config by host.
56
- */
57
- compute(host: string): Record<string, string | string[]>;
58
- /**
59
- * Query SSH config by host and user.
60
- */
61
- compute(opts: MatchOptions): Record<string, string | string[]>;
62
- /**
63
- * Find by Host or Match.
64
- */
65
- find(opts: FindOptions): Line | undefined;
66
- /**
67
- * Find by search function.
68
- * @param predicate Function to check against each line; should return a truthy value when a
69
- * matching line is given.
70
- */
71
- find(predicate: (line: Line, index: number, config: Line[]) => unknown): Line | undefined;
72
- /**
73
- * Remove section by Host or Match.
74
- */
75
- remove(opts: FindOptions): Line[] | undefined;
76
- /**
77
- * Remove section by search function.
78
- * @param predicate Function to check against each line; should return a truthy value when a
79
- * matching line is given.
80
- */
81
- remove(predicate: (line: Line, index: number, config: Line[]) => unknown): Line[] | undefined;
82
- toString(): string;
83
- /**
84
- * Append new section to existing SSH config.
85
- */
86
- append(opts: Record<string, string | string[]>): SSHConfig;
87
- /**
88
- * Prepend new section to existing SSH config.
89
- */
90
- prepend(opts: Record<string, string | string[]>, beforeFirstSection?: boolean): SSHConfig;
91
- }
92
- /**
93
- * Parse SSH config text into structured object.
94
- */
95
- export declare function parse(text: string): SSHConfig;
96
- /**
97
- * Stringify structured object into SSH config text.
98
- */
99
- export declare function stringify(config: SSHConfig): string;