@@ -35,48 +35,75 @@ private static int Main(string[] args)
3535 options ,
3636 ( verb , subOptions ) =>
3737 {
38- if ( subOptions != null )
38+ result = 1 ;
39+
40+ var baseSubOptions = subOptions as BaseSubOptions ;
41+ if ( baseSubOptions != null )
3942 {
40- if ( string . IsNullOrEmpty ( ( ( BaseSubOptions ) subOptions ) . TargetPath ) )
43+ if ( string . IsNullOrEmpty ( baseSubOptions . TargetPath ) )
4144 {
42- ( ( BaseSubOptions ) subOptions ) . TargetPath = Environment . CurrentDirectory ;
45+ baseSubOptions . TargetPath = Environment . CurrentDirectory ;
4346 }
4447
45- ConfigureLogging ( ( ( BaseSubOptions ) subOptions ) . LogFilePath ) ;
48+ ConfigureLogging ( baseSubOptions . LogFilePath ) ;
4649 }
4750
4851 var fileSystem = new FileSystem ( ) ;
4952
5053 if ( verb == "create" )
5154 {
52- result = CreateReleaseAsync ( ( CreateSubOptions ) subOptions , fileSystem ) . Result ;
55+ var createSubOptions = baseSubOptions as CreateSubOptions ;
56+ if ( createSubOptions != null )
57+ {
58+ result = CreateReleaseAsync ( createSubOptions , fileSystem ) . Result ;
59+ }
5360 }
5461
5562 if ( verb == "close" )
5663 {
57- result = CloseMilestoneAsync ( ( CloseSubOptions ) subOptions ) . Result ;
64+ var closeSubOptions = baseSubOptions as CloseSubOptions ;
65+ if ( closeSubOptions != null )
66+ {
67+ result = CloseMilestoneAsync ( closeSubOptions ) . Result ;
68+ }
5869 }
5970
6071 if ( verb == "publish" )
6172 {
62- result = CloseAndPublishReleaseAsync ( ( PublishSubOptions ) subOptions ) . Result ;
73+ var publishSubOptions = baseSubOptions as PublishSubOptions ;
74+ if ( publishSubOptions != null )
75+ {
76+ result = CloseAndPublishReleaseAsync ( publishSubOptions ) . Result ;
77+ }
6378 }
6479
6580 if ( verb == "export" )
6681 {
67- result = ExportReleasesAsync ( ( ExportSubOptions ) subOptions ) . Result ;
82+ var exportSubOptions = baseSubOptions as ExportSubOptions ;
83+ if ( exportSubOptions != null )
84+ {
85+ result = ExportReleasesAsync ( exportSubOptions ) . Result ;
86+ }
6887 }
6988
7089 if ( verb == "init" )
7190 {
72- ConfigurationProvider . WriteSample ( ( ( InitSubOptions ) subOptions ) . TargetPath , fileSystem ) ;
73- result = 0 ;
91+ var initSubOptions = baseSubOptions as InitSubOptions ;
92+ if ( initSubOptions != null )
93+ {
94+ ConfigurationProvider . WriteSample ( initSubOptions . TargetPath , fileSystem ) ;
95+ result = 0 ;
96+ }
7497 }
7598
7699 if ( verb == "showconfig" )
77100 {
78- Console . WriteLine ( ConfigurationProvider . GetEffectiveConfigAsString ( ( ( ShowConfigSubOptions ) subOptions ) . TargetPath , fileSystem ) ) ;
79- result = 0 ;
101+ var showConfigSubOptions = baseSubOptions as ShowConfigSubOptions ;
102+ if ( showConfigSubOptions != null )
103+ {
104+ Console . WriteLine ( ConfigurationProvider . GetEffectiveConfigAsString ( showConfigSubOptions . TargetPath , fileSystem ) ) ;
105+ result = 0 ;
106+ }
80107 }
81108 } ) )
82109 {
0 commit comments