@@ -29,25 +29,25 @@ public void Interpret(string[] args)
2929 ExitWithSuccess ( ) ;
3030 }
3131
32- var parser = new CommandLine . Parser ( with => with . IgnoreUnknownArguments = true ) ;
32+ var parser = new Parser ( with => with . IgnoreUnknownArguments = true ) ;
3333 var options = new Options ( ) ;
3434
3535 if ( parser . ParseArguments ( args , options ) )
3636 {
3737 if ( options == null )
38- Environment . Exit ( CommandLine . Parser . DefaultExitCodeFail ) ;
38+ Environment . Exit ( Parser . DefaultExitCodeFail ) ;
3939
40- var plugin = plugins . FirstOrDefault ( x => x . Name == options . PlugInName ) ;
40+ var plugin = plugins . FirstOrDefault ( x => x . Name == options . PluginName ) ;
4141 if ( plugin == null )
42- ExitWithFailure ( "Plugin does not exist: " + options . PlugInName ) ;
42+ ExitWithFailure ( "Plugin does not exist: " + options . PluginName ) ;
4343
4444 var pluginOptionList = plugin . MakeOptions ( ) ;
4545
4646 var pluginArgs = args . Skip ( 1 ) . ToArray ( ) ;
4747 if ( ! pluginArgs . ToList ( ) . Any ( ) ) {
4848 // If the plugin's args are empty, print the plugin's help screen and exit.
4949 foreach ( var pluginOptions in pluginOptionList ) {
50- CommandLine . Parser . Default . ParseArguments ( pluginArgs , pluginOptions ) ;
50+ Parser . Default . ParseArguments ( pluginArgs , pluginOptions ) ;
5151 Console . WriteLine ( pluginOptions . GetUsage ( "" ) ) ;
5252 }
5353 ExitWithSuccess ( ) ;
@@ -72,16 +72,22 @@ public void ExitWithSuccess(string message = null)
7272
7373 public void ExitWithFailure ( string message = null )
7474 {
75- if ( string . IsNullOrWhiteSpace ( message ) )
76- message = "fail" ;
77- Logger . Error ( $ "✘ { message } ") ;
78- Environment . Exit ( CommandLine . Parser . DefaultExitCodeFail ) ;
75+ Logger . Error ( MakeErrorMessage ( message ) ) ;
76+ Environment . Exit ( Parser . DefaultExitCodeFail ) ;
7977 }
8078
8179 public void ExitWithFailure ( Exception exception = null )
8280 {
83- Logger . Error ( exception ?? new CommandFailedException ( ) , "✘ fail" ) ;
84- Environment . Exit ( CommandLine . Parser . DefaultExitCodeFail ) ;
81+ var ex = exception ?? new Exception ( "Unspecified failure" ) ;
82+ Logger . Error ( ex , MakeErrorMessage ( ex . Message ) ) ;
83+ Environment . Exit ( Parser . DefaultExitCodeFail ) ;
84+ }
85+
86+ protected string MakeErrorMessage ( string message = null )
87+ {
88+ if ( string . IsNullOrWhiteSpace ( message ) )
89+ message = "fail" ;
90+ return $ "✘ { message } ";
8591 }
8692
8793 public List < Plugin > FindPlugins ( )
@@ -96,8 +102,7 @@ public List<Plugin> FindPlugins()
96102
97103 public void InterpretPluginArguments ( string [ ] pluginArgs , IOptions pluginOptions )
98104 {
99- var isSuccessful = CommandLine
100- . Parser
105+ var isSuccessful = Parser
101106 . Default
102107 . ParseArguments ( pluginArgs , pluginOptions , ( verb , subOptions ) =>
103108 {
0 commit comments