@@ -12,6 +12,7 @@ public class Repl : ScriptExecutor, IRepl
1212 private readonly string [ ] _scriptArgs ;
1313
1414 private readonly IObjectSerializer _serializer ;
15+ private readonly Printers _printers ;
1516 private readonly ILog _log ;
1617
1718 [ Obsolete ( "Support for Common.Logging types was deprecated in version 0.15.0 and will soon be removed." ) ]
@@ -24,7 +25,8 @@ public Repl(
2425 IScriptLibraryComposer composer ,
2526 IConsole console ,
2627 IFilePreProcessor filePreProcessor ,
27- IEnumerable < IReplCommand > replCommands )
28+ IEnumerable < IReplCommand > replCommands ,
29+ Printers printers )
2830 : this (
2931 scriptArgs ,
3032 fileSystem ,
@@ -34,7 +36,8 @@ public Repl(
3436 composer ,
3537 console ,
3638 filePreProcessor ,
37- replCommands )
39+ replCommands ,
40+ printers )
3841 {
3942 }
4043
@@ -47,7 +50,8 @@ public Repl(
4750 IScriptLibraryComposer composer ,
4851 IConsole console ,
4952 IFilePreProcessor filePreProcessor ,
50- IEnumerable < IReplCommand > replCommands )
53+ IEnumerable < IReplCommand > replCommands ,
54+ Printers printers )
5155 : base ( fileSystem , filePreProcessor , scriptEngine , logProvider , composer )
5256 {
5357 Guard . AgainstNullArgument ( "serializer" , serializer ) ;
@@ -56,6 +60,7 @@ public Repl(
5660
5761 _scriptArgs = scriptArgs ;
5862 _serializer = serializer ;
63+ _printers = printers ;
5964 _log = logProvider . ForCurrentType ( ) ;
6065 Console = console ;
6166 Commands = replCommands != null ? replCommands . Where ( x => x . CommandName != null ) . ToDictionary ( x => x . CommandName , x => x ) : new Dictionary < string , IReplCommand > ( ) ;
@@ -133,7 +138,7 @@ public override ScriptResult Execute(string script, params string[] scriptArgs)
133138 }
134139
135140 Console . ForegroundColor = ConsoleColor . Cyan ;
136-
141+
137142 InjectScriptLibraries ( FileSystem . CurrentDirectory , preProcessResult , ScriptPackSession . State ) ;
138143
139144 Buffer = ( Buffer == null )
@@ -172,9 +177,7 @@ public override ScriptResult Execute(string script, params string[] scriptArgs)
172177 {
173178 Console . ForegroundColor = ConsoleColor . Yellow ;
174179
175- var serializedResult = _serializer . Serialize ( result . ReturnValue ) ;
176-
177- Console . WriteLine ( serializedResult ) ;
180+ Console . WriteLine ( _printers . GetStringFor ( result . ReturnValue ) ) ;
178181 }
179182
180183 Buffer = null ;
0 commit comments