Compare commits
4 commits
89efeec505
...
9180aa998d
Author | SHA1 | Date | |
---|---|---|---|
9180aa998d | |||
f7504ac041 | |||
bee369b5f8 | |||
|
3a4559723b |
1 changed files with 4 additions and 4 deletions
|
@ -92,12 +92,12 @@ pub fn parse_args_1(arg: &String) -> String{
|
||||||
|
|
||||||
|
|
||||||
pub fn parse_args_2(arg: &String) -> String{
|
pub fn parse_args_2(arg: &String) -> String{
|
||||||
let possible: Vec<&str> = vec!["start", "stop", "reload", "restart", "shutdown", "force-stop", "force-reload", "force-restart", "force-shutdown", "try-restart"];
|
const POSSIBLE: &'static [&'static str] = &["start", "stop", "reload", "restart", "shutdown", "force-stop", "force-reload", "force-restart", "force-shutdown", "try-restart"];
|
||||||
let cpossible: Vec<char> = vec!['s', 'u', 'd', 'o', 'p', 'c', 'h', 'a', 'i', 'q', '1', '2', 't', 'k'];
|
const CPOSSIBLE: &'static [char] = &['s', 'u', 'd', 'o', 'p', 'c', 'h', 'a', 'i', 'q', '1', '2', 't', 'k'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for var in possible.iter() {
|
for var in POSSIBLE.iter() {
|
||||||
if arg == var {
|
if arg == var {
|
||||||
return var.to_string()
|
return var.to_string()
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ pub fn parse_args_2(arg: &String) -> String{
|
||||||
let ch1 = arg.chars().next().unwrap();
|
let ch1 = arg.chars().next().unwrap();
|
||||||
|
|
||||||
|
|
||||||
for var in cpossible.iter() {
|
for var in CPOSSIBLE.iter() {
|
||||||
if ch1 == *var {
|
if ch1 == *var {
|
||||||
return ch1.to_string()
|
return ch1.to_string()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue