11using System . CommandLine ;
2- using System . CommandLine . Parsing ;
32using MaterialDesignThemes . Wpf ;
43
54namespace MaterialDesign . Shared ;
65
76internal static class CommandLineOptions
87{
98 private static readonly Option < string > PageOption =
10- new ( aliases : new [ ] { "--page" , "-p" } ,
11- getDefaultValue : ( ) => "Home" ,
12- description : "Sets the startup page of the Demo app." ) ;
9+ new ( "--page" , "-p" )
10+ {
11+ DefaultValueFactory = _ => "Home" ,
12+ Description = "Sets the startup page of the Demo app."
13+ } ;
1314
1415 private static readonly Option < FlowDirection > FlowDirectionOption =
15- new ( aliases : new [ ] { "--flowDirection" , "-f" } ,
16- getDefaultValue : ( ) => FlowDirection . LeftToRight ,
17- description : "Sets the startup flow direction of the Demo app." ) ;
16+ new ( "--flowDirection" , "-f" )
17+ {
18+ DefaultValueFactory = _ => FlowDirection . LeftToRight ,
19+ Description = "Sets the startup flow direction of the Demo app."
20+ } ;
1821
1922 private static readonly Option < BaseTheme > ThemeOption =
20- new ( aliases : new [ ] { "--theme" , "-t" } ,
21- getDefaultValue : ( ) => BaseTheme . Inherit ,
22- description : "Sets the startup theme of the Demo app." ) ;
23+ new ( "--theme" , "-t" )
24+ {
25+ DefaultValueFactory = _ => BaseTheme . Inherit ,
26+ Description = "Sets the startup theme of the Demo app."
27+ } ;
2328
2429 private static readonly RootCommand RootCommand =
2530 new ( description : "MaterialDesignInXamlToolkit Demo app command line options." )
@@ -34,9 +39,9 @@ public static (string? StartPage, FlowDirection FlowDirection, BaseTheme BaseThe
3439 ParseResult parseResult = RootCommand . Parse ( args ) ;
3540
3641 return new (
37- parseResult . GetValueForOption ( PageOption ) ,
38- parseResult . GetValueForOption ( FlowDirectionOption ) ,
39- parseResult . GetValueForOption ( ThemeOption )
42+ parseResult . GetValue ( PageOption ) ,
43+ parseResult . GetValue ( FlowDirectionOption ) ,
44+ parseResult . GetValue ( ThemeOption )
4045 ) ;
4146 }
4247}
0 commit comments