@@ -37,12 +37,13 @@ export class Cli implements ICli {
37
37
opts . maxBuffer = 2 * 1024 * 1024 ;
38
38
}
39
39
childProcess . exec ( cmd , opts , ( error : ExecException , stdout : string , stderr : string ) => {
40
- this . odoChannel . print ( stdout ) ;
40
+ const stdoutFiltered = stdout . replace ( / - - - [ \s \S ] * $ / g, '' ) . trim ( )
41
+ this . odoChannel . print ( stdoutFiltered ) ;
41
42
this . odoChannel . print ( stderr ) ;
42
43
// do not reject it here, because caller in some cases need the error and the streams
43
44
// to make a decision
44
45
// Filter update message text which starts with `---`
45
- resolve ( { error, stdout : stdout . replace ( / - - - [ \s \S ] * $ / g , '' ) . trim ( ) , stderr } ) ;
46
+ resolve ( { error, stdout : stdoutFiltered , stderr } ) ;
46
47
} ) ;
47
48
} ) ;
48
49
}
@@ -64,9 +65,20 @@ class OdoChannelImpl implements OdoChannel {
64
65
this . channel . show ( ) ;
65
66
}
66
67
68
+ prettifyJson ( str : string ) {
69
+ let jsonData : string ;
70
+ try {
71
+ jsonData = JSON . stringify ( JSON . parse ( str ) , null , 2 ) ;
72
+ } catch ( ignore ) {
73
+ return str ;
74
+ }
75
+ return jsonData ;
76
+ }
77
+
67
78
print ( text : string ) : void {
68
- this . channel . append ( text ) ;
69
- if ( text . charAt ( text . length - 1 ) !== '\n' ) {
79
+ const textData = this . prettifyJson ( text ) ;
80
+ this . channel . append ( textData ) ;
81
+ if ( textData . charAt ( textData . length - 1 ) !== '\n' ) {
70
82
this . channel . append ( '\n' ) ;
71
83
}
72
84
if ( vscode . workspace . getConfiguration ( 'openshiftConnector' ) . get < boolean > ( 'showChannelOnOutput' ) ) {
0 commit comments