forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsync.d.ts
96 lines (72 loc) · 2.38 KB
/
rsync.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Type definitions for node-rsync v0.4.0
// Project: https://github.com/mattijs/node-rsync
// Definitions by: Philipp Stucki <https://github.com/philippstucki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'rsync' {
import * as child_process from 'child_process';
interface StreamDataHandler {
(data: any): void;
}
interface Pattern {
action: string;
pattern: string;
}
interface Flag {
[name: string]: boolean;
}
interface Rsync {
// instance methods
set(option: string, value: string): Rsync;
set(option: string): Rsync;
unset(option: string): Rsync;
flags(flags: string, set?: boolean): Rsync;
flags(flags: Flag): Rsync;
flags(flags: string[], set?: boolean): Rsync;
flags(...flags: any[]): Rsync;
isSet(option: string): boolean;
option(option: string): any;
args(): string[];
command(): string;
output(stdout: StreamDataHandler, stderr: StreamDataHandler): Rsync;
execute(callback: (err: Error, code: number, cmd: string) => void): child_process.ChildProcess;
execute(
callback: (err: Error, code: number, cmd: string) => void,
stdout: StreamDataHandler,
stderr: StreamDataHandler
): child_process.ChildProcess;
// option shorthands
shell(shell: string): Rsync;
delete(): Rsync;
progress(): Rsync;
archive(): Rsync;
compress(): Rsync;
recursive(): Rsync;
update(): Rsync;
quiet(): Rsync;
dirs(): Rsync;
links(): Rsync;
dry(): Rsync;
// accessor methods
executable(): string;
executable(e: string): Rsync;
executableShell(): string;
executableShell(e: string): Rsync;
destination(): string;
destination(d: string): Rsync;
source(): string[];
source(s: string): Rsync;
source(s: string[]): Rsync;
// pattern accessors
patterns(patterns: (string|Pattern)[]): Rsync;
exclude(p: string): Rsync;
exclude(p: string[]): Rsync;
include(p: string): Rsync;
include(p: string[]): Rsync;
}
interface RsyncStatic {
new(): Rsync;
}
const e: RsyncStatic;
export = e;
}