@@ -7,44 +7,30 @@ pub mod run;
7
7
pub struct Command {
8
8
pub profile : Profile ,
9
9
pub daemon_mode : bool ,
10
- pub pid_to_kill : String ,
11
10
pub processes_to_run : Vec < String > ,
12
11
pub verbosity : String ,
13
12
}
14
13
15
14
pub fn get_command ( matches : ArgMatches ) -> Command {
16
- let mut cmd_profile: Profile = Profile :: new ( ) ;
17
- let mut cmd_daemon: bool = false ;
18
- let mut cmd_kill: String = String :: new ( ) ;
19
- let mut cmd_processes: Vec < String > = Vec :: new ( ) ;
15
+ let file: String = matches. value_of ( "file" ) . unwrap_or ( "arpx.yaml" ) . to_string ( ) ;
16
+ let cmd_profile = match get_profile ( file) {
17
+ Ok ( profile) => profile,
18
+ Err ( error) => panic ! ( error) ,
19
+ } ;
20
20
21
- if matches. is_present ( "ls" ) {
22
- println ! ( "NOTE: Processes cannot be listed. Feature not fully implemented yet." ) ;
21
+ let mut cmd_processes: Vec < String > = Vec :: new ( ) ;
22
+ if let Some ( ref process) = matches. value_of ( "process" ) {
23
+ cmd_processes. push ( process. to_string ( ) ) ;
23
24
} else {
24
- let file: String = matches. value_of ( "file" ) . unwrap_or ( "arpx.yaml" ) . to_string ( ) ;
25
-
26
- cmd_profile = match get_profile ( file) {
27
- Ok ( profile) => profile,
28
- Err ( error) => panic ! ( error) ,
29
- } ;
30
-
31
- if matches. is_present ( "daemon" ) {
32
- cmd_daemon = true ;
33
- println ! ( "NOTE: Daemon mode not invoked. Feature not fully implemented yet." ) ;
34
- }
35
-
36
- if let Some ( pid) = matches. value_of ( "kill" ) {
37
- cmd_kill = pid. to_string ( ) ;
38
- println ! ( "NOTE: Process cannot be killed. Feature not fully implemented yet." ) ;
25
+ for process in cmd_profile. processes . iter ( ) {
26
+ cmd_processes. push ( process. name [ ..] . to_string ( ) ) ;
39
27
}
28
+ }
40
29
41
- if let Some ( ref process) = matches. value_of ( "process" ) {
42
- cmd_processes. push ( process. to_string ( ) ) ;
43
- } else {
44
- for process in cmd_profile. processes . iter ( ) {
45
- cmd_processes. push ( process. name [ ..] . to_string ( ) ) ;
46
- }
47
- }
30
+ let mut cmd_daemon: bool = false ;
31
+ if matches. is_present ( "daemon" ) {
32
+ cmd_daemon = true ;
33
+ println ! ( "NOTE: Daemon mode not invoked. Feature not fully implemented yet." ) ;
48
34
}
49
35
50
36
let cmd_verbosity = match matches. occurrences_of ( "v" ) {
@@ -61,7 +47,6 @@ pub fn get_command(matches: ArgMatches) -> Command {
61
47
Command {
62
48
profile : cmd_profile,
63
49
daemon_mode : cmd_daemon,
64
- pid_to_kill : cmd_kill,
65
50
processes_to_run : cmd_processes,
66
51
verbosity : cmd_verbosity,
67
52
}
0 commit comments