@@ -31,24 +31,41 @@ pub enum SetOperator {
3131/// Represents the parsed command-line arguments and their intended actions.
3232#[ derive( Debug , PartialEq ) ]
3333pub enum CliAction {
34+ /// Display version information and exit
35+ ShowVersion ,
36+
37+ /// Display help information and exit
38+ ShowHelp ,
39+
40+ /// Show help due to unknown arguments and exit
41+ ShowHelpDueToError ,
42+
43+ /// Display detailed help for a specific command or general help
44+ HelpCommand { command : Option < String > } ,
45+
46+ /// Display usage help for a specific command (--help flag in command context)
47+ UsageHelp { command : String } ,
48+
49+ /// Show command-specific usage due to error
50+ ShowCommandUsageDueToError {
51+ command : String ,
52+ error_message : String ,
53+ } ,
54+
3455 /// Run the normal application with these settings
3556 Run {
3657 debug_enabled : bool ,
3758 config_dir : Option < String > ,
3859 background : bool ,
3960 } ,
4061
41- /// Test using subcommand syntax
42- TestCommand {
43- debug_enabled : bool ,
44- temperature : u32 ,
45- gamma : f64 ,
46- config_dir : Option < String > ,
47- } ,
48-
49- /// Geo using subcommand syntax
50- GeoCommand {
62+ /// Simulate time passing for testing
63+ Simulate {
5164 debug_enabled : bool ,
65+ start_time : String ,
66+ end_time : String ,
67+ multiplier : f64 ,
68+ log_to_file : bool ,
5269 config_dir : Option < String > ,
5370 } ,
5471
@@ -59,35 +76,32 @@ pub enum CliAction {
5976 config_dir : Option < String > ,
6077 } ,
6178
62- /// Set configuration field subcommand
63- SetCommand {
79+ /// Restart using subcommand syntax
80+ RestartCommand {
6481 debug_enabled : bool ,
65- fields : Vec < ( String , SetOperator , String ) > ,
82+ instant : bool ,
6683 config_dir : Option < String > ,
67- target : Option < String > ,
84+ background : bool ,
6885 } ,
6986
70- /// Get configuration field subcommand
71- GetCommand {
87+ /// Stop using subcommand syntax
88+ StopCommand {
7289 debug_enabled : bool ,
73- fields : Vec < String > ,
7490 config_dir : Option < String > ,
75- target : Option < String > ,
76- json : bool ,
7791 } ,
7892
79- /// Stop using subcommand syntax
80- StopCommand {
93+ /// Geo using subcommand syntax
94+ GeoCommand {
8195 debug_enabled : bool ,
8296 config_dir : Option < String > ,
8397 } ,
8498
85- /// Restart using subcommand syntax
86- RestartCommand {
99+ /// Test using subcommand syntax
100+ TestCommand {
87101 debug_enabled : bool ,
88- instant : bool ,
102+ temperature : u32 ,
103+ gamma : f64 ,
89104 config_dir : Option < String > ,
90- background : bool ,
91105 } ,
92106
93107 /// Status command - display current runtime state
@@ -97,35 +111,21 @@ pub enum CliAction {
97111 follow : bool ,
98112 } ,
99113
100- /// Display detailed help for a specific command or general help
101- HelpCommand { command : Option < String > } ,
102-
103- /// Display usage help for a specific command (--help flag in command context)
104- UsageHelp { command : String } ,
105-
106- /// Simulate time passing for testing
107- Simulate {
114+ /// Set configuration field subcommand
115+ SetCommand {
108116 debug_enabled : bool ,
109- start_time : String ,
110- end_time : String ,
111- multiplier : f64 ,
112- log_to_file : bool ,
117+ fields : Vec < ( String , SetOperator , String ) > ,
113118 config_dir : Option < String > ,
119+ target : Option < String > ,
114120 } ,
115121
116- /// Display help information and exit
117- ShowHelp ,
118-
119- /// Display version information and exit
120- ShowVersion ,
121-
122- /// Show help due to unknown arguments and exit
123- ShowHelpDueToError ,
124-
125- /// Show command-specific usage due to error
126- ShowCommandUsageDueToError {
127- command : String ,
128- error_message : String ,
122+ /// Get configuration field subcommand
123+ GetCommand {
124+ debug_enabled : bool ,
125+ fields : Vec < String > ,
126+ config_dir : Option < String > ,
127+ target : Option < String > ,
128+ json : bool ,
129129 } ,
130130}
131131
@@ -134,14 +134,14 @@ impl CliAction {
134134 pub fn config_dir ( & self ) -> Option < & str > {
135135 match self {
136136 Self :: Run { config_dir, .. }
137- | Self :: TestCommand { config_dir, .. }
138- | Self :: GeoCommand { config_dir, .. }
137+ | Self :: Simulate { config_dir, .. }
139138 | Self :: PresetCommand { config_dir, .. }
140- | Self :: SetCommand { config_dir, .. }
141- | Self :: GetCommand { config_dir, .. }
142- | Self :: StopCommand { config_dir, .. }
143139 | Self :: RestartCommand { config_dir, .. }
144- | Self :: Simulate { config_dir, .. } => config_dir. as_deref ( ) ,
140+ | Self :: StopCommand { config_dir, .. }
141+ | Self :: GeoCommand { config_dir, .. }
142+ | Self :: TestCommand { config_dir, .. }
143+ | Self :: SetCommand { config_dir, .. }
144+ | Self :: GetCommand { config_dir, .. } => config_dir. as_deref ( ) ,
145145 _ => None ,
146146 }
147147 }
0 commit comments