mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
support semicolon seperated command lines
This commit is contained in:
parent
73564e6a01
commit
662b5d0cf7
|
@ -236,10 +236,19 @@ func (ms *MasterServer) startAdminScripts() {
|
||||||
for range c {
|
for range c {
|
||||||
if ms.Topo.IsLeader() {
|
if ms.Topo.IsLeader() {
|
||||||
for _, line := range scriptLines {
|
for _, line := range scriptLines {
|
||||||
|
for _, c := range strings.Split(line, ";") {
|
||||||
|
processEachCmd(reg, c, commandEnv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func processEachCmd(reg *regexp.Regexp, line string, commandEnv *shell.CommandEnv) {
|
||||||
cmds := reg.FindAllString(line, -1)
|
cmds := reg.FindAllString(line, -1)
|
||||||
if len(cmds) == 0 {
|
if len(cmds) == 0 {
|
||||||
continue
|
return
|
||||||
}
|
}
|
||||||
args := make([]string, len(cmds[1:]))
|
args := make([]string, len(cmds[1:]))
|
||||||
for i := range args {
|
for i := range args {
|
||||||
|
@ -255,10 +264,6 @@ func (ms *MasterServer) startAdminScripts() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *MasterServer) createSequencer(option *MasterOption) sequence.Sequencer {
|
func (ms *MasterServer) createSequencer(option *MasterOption) sequence.Sequencer {
|
||||||
|
|
|
@ -45,9 +45,18 @@ func RunShell(options ShellOptions) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, c := range strings.Split(cmd, ";") {
|
||||||
|
if processEachCmd(reg, c, commandEnv) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func processEachCmd(reg *regexp.Regexp, cmd string, commandEnv *CommandEnv) bool {
|
||||||
cmds := reg.FindAllString(cmd, -1)
|
cmds := reg.FindAllString(cmd, -1)
|
||||||
if len(cmds) == 0 {
|
if len(cmds) == 0 {
|
||||||
continue
|
return false
|
||||||
} else {
|
} else {
|
||||||
line.AppendHistory(cmd)
|
line.AppendHistory(cmd)
|
||||||
|
|
||||||
|
@ -61,7 +70,7 @@ func RunShell(options ShellOptions) {
|
||||||
if cmd == "help" || cmd == "?" {
|
if cmd == "help" || cmd == "?" {
|
||||||
printHelp(cmds)
|
printHelp(cmds)
|
||||||
} else if cmd == "exit" || cmd == "quit" {
|
} else if cmd == "exit" || cmd == "quit" {
|
||||||
return
|
return true
|
||||||
} else {
|
} else {
|
||||||
foundCommand := false
|
foundCommand := false
|
||||||
for _, c := range Commands {
|
for _, c := range Commands {
|
||||||
|
@ -78,7 +87,7 @@ func RunShell(options ShellOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func printGenericHelp() {
|
func printGenericHelp() {
|
||||||
|
|
Loading…
Reference in a new issue