UNPKG

2.06 kBTypeScriptView Raw
1export declare type MachineProps = 'login' | 'account' | 'password';
2export interface Macdef {
3 type: 'macdef';
4 content: string;
5}
6export interface Newline {
7 type: 'newline';
8 content: string;
9}
10export interface Comment {
11 type: 'comment';
12 content: string;
13}
14export declare type Token = Machine | Prop | DefaultMachine | Macdef | Newline | Comment;
15export interface IMachine {
16 login?: string;
17 password?: string;
18 account?: string;
19}
20export interface Options {
21 pre?: string;
22 post?: string;
23 elements?: Element[];
24}
25export declare abstract class Base {
26 pre: string;
27 post: string;
28 protected _tokens?: Token[];
29 constructor({pre, post}?: Options);
30 addToken(token: Token): void;
31 readonly content: string;
32 protected readonly _content: string;
33}
34export declare class Prop extends Base {
35 type: 'prop';
36 name: MachineProps;
37 value: string;
38 constructor(opts: Options & {
39 name: MachineProps;
40 value: string;
41 });
42 protected readonly _content: string;
43}
44export interface MachineOptions extends Options {
45 login?: string;
46 password?: string;
47 account?: string;
48}
49export declare abstract class MachineBase extends Base {
50 protected _tokens: Token[];
51 constructor({login, password, account, ...opts}?: MachineOptions);
52 login: string | undefined;
53 password: string | undefined;
54 account: string | undefined;
55 private getProp(name);
56 private setProp(name, value);
57 private readonly _props;
58 private newPropPre();
59 private newPropPost();
60 private isMultiline();
61}
62export declare class Machine extends MachineBase {
63 type: 'machine';
64 host: string;
65 constructor({host, ...opts}: MachineOptions & {
66 host: string;
67 });
68 protected readonly _content: string;
69}
70export declare class DefaultMachine extends MachineBase {
71 type: 'default';
72 protected readonly _content: string;
73}
74export interface Machines {
75 [host: string]: IMachine;
76}
77export declare function machinesProxy(tokens?: Token[]): Machines;