add --name option. fix parse \" error
This commit is contained in:
parent
d6cae41111
commit
d85d8b3059
|
@ -36,6 +36,7 @@ func init() {
|
|||
// 自定义
|
||||
{"--task", 10, parseITask, &extract{re: "--task +(.+)", execute: extractData}},
|
||||
{"--crontab", 10, parseCrontab, &extract{re: "--crontab +(.+)", execute: extractData}},
|
||||
{"--name", 10, parseName, &extract{re: "--name +(.+)", execute: extractData}},
|
||||
}
|
||||
|
||||
for _, oe := range oelist {
|
||||
|
@ -86,13 +87,17 @@ func judgeOptions(u *CURL, soption string) *parseFunction {
|
|||
return oe.BuildFunction(u, soption)
|
||||
}
|
||||
|
||||
log.Println(soption, " no haved this option")
|
||||
log.Println(soption, " not this option")
|
||||
return nil
|
||||
}
|
||||
|
||||
func extractData(re, soption string) string {
|
||||
datas := regexp.MustCompile(re).FindStringSubmatch(soption)
|
||||
return strings.Trim(datas[1], "'")
|
||||
return strings.Trim(datas[1], "'\"")
|
||||
}
|
||||
|
||||
func parseName(u *CURL, value string) {
|
||||
u.Name = value
|
||||
}
|
||||
|
||||
func parseCrontab(u *CURL, value string) {
|
||||
|
|
|
@ -25,6 +25,7 @@ type CURL struct {
|
|||
|
||||
ITask string
|
||||
Crontab string
|
||||
Name string
|
||||
}
|
||||
|
||||
// New new 一个 curl 出来
|
||||
|
|
Loading…
Reference in New Issue
Block a user