88use phpbu \App \Backup \Target ;
99use phpbu \App \Configuration ;
1010use phpbu \App \Result ;
11+ use SebastianFeldmann \Cli \Util ;
1112
1213/**
1314 * Restore Runner
@@ -135,12 +136,17 @@ private function restoreBackup(Target $target, Configuration\Backup $backup, Pla
135136 private function printDecryptionCommands (Plan $ plan ): void
136137 {
137138 if (!$ plan ->isCryptSupported ()) {
138- echo "WARNING: Your configured crypt does not support restore for now. \n" ;
139+ echo Util:: formatWithColor ( ' fg-red ' , "WARNING: Your configured crypt does not support restore for now. \n" ) ;
139140 return ;
140141 }
142+ $ commands = $ plan ->getDecryptionCommands ();
141143
142- echo "---- Decrypt your backup \n" ;
143- foreach ($ plan ->getDecryptionCommands () as $ cmd ) {
144+ if (empty ($ commands )) {
145+ return ;
146+ }
147+
148+ echo Util::formatWithColor ('fg-yellow ' , "# Decrypt your backup \n" );
149+ foreach ($ commands as $ cmd ) {
144150 echo $ cmd . PHP_EOL ;
145151 }
146152 echo PHP_EOL ;
@@ -155,13 +161,13 @@ private function printDecryptionCommands(Plan $plan): void
155161 private function printRestoreCommands (Plan $ plan ): void
156162 {
157163 if (!$ plan ->isSourceSupported ()) {
158- echo "WARNING: Your configured source does not support restore for now. \n" ;
164+ echo Util:: formatWithColor ( ' fg-red ' , "WARNING: Your configured source does not support restore for now. \n" ) ;
159165 return ;
160166 }
161167
162168 $ this ->printExtractionCommands ($ plan ->getDecompressionCommands ());
163169
164- echo " ---- Restore your data [BE CAREFUL] \n" ;
170+ echo Util:: formatWithColor ( ' fg-yellow ' , " # Restore your data [BE CAREFUL] \n") ;
165171 foreach ($ plan ->getRestoreCommands () as $ cmd ) {
166172 echo $ cmd . PHP_EOL ;
167173 }
@@ -177,7 +183,7 @@ private function printRestoreCommands(Plan $plan): void
177183 private function printExtractionCommands (array $ commands ): void
178184 {
179185 if (!empty ($ commands )) {
180- echo " ---- Extract your backup \n" ;
186+ echo Util:: formatWithColor ( ' fg-yellow ' , " # Extract your backup \n") ;
181187 foreach ($ commands as $ cmd ) {
182188 echo $ cmd . PHP_EOL ;
183189 }
0 commit comments