File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ function borg(...args: string[]): Promise<Deno.CommandOutput> {
8
8
return new Deno . Command ( "borg" , { args } ) . output ( ) ;
9
9
}
10
10
11
+ function print ( encoded : Uint8Array ) : void {
12
+ console . log ( new TextDecoder ( ) . decode ( encoded ) ) ;
13
+ }
14
+
11
15
const command = new Command ( )
12
16
. name ( "backup" )
13
17
. option ( "-v --verbose" , "Enable verbose logging" )
@@ -45,9 +49,11 @@ const command = new Command()
45
49
const resp = await borg ( "init" , "-e=none" , repo ) ;
46
50
if ( ! resp . success ) {
47
51
console . log ( "failed to init repo" ) ;
48
- if ( verbose ) console . log ( new TextDecoder ( ) . decode ( resp . stderr ) ) ;
52
+ if ( verbose ) print ( resp . stderr ) ;
49
53
Deno . exit ( 1 ) ;
50
54
}
55
+
56
+ if ( verbose ) print ( resp . stderr ) ;
51
57
}
52
58
53
59
const bytes = new Uint8Array ( 6 ) ;
@@ -63,11 +69,11 @@ const command = new Command()
63
69
64
70
if ( ! resp . success ) {
65
71
console . log ( "failed to create backup" ) ;
66
- if ( verbose ) console . log ( new TextDecoder ( ) . decode ( resp . stderr ) ) ;
72
+ if ( verbose ) print ( resp . stderr ) ;
67
73
Deno . exit ( 1 ) ;
68
74
}
69
75
70
- if ( verbose ) console . log ( new TextDecoder ( ) . decode ( resp . stderr ) ) ;
76
+ if ( verbose ) print ( resp . stderr ) ;
71
77
72
78
// TODO: Automatic rclone
73
79
} ) ;
You can’t perform that action at this time.
0 commit comments