Skip to content
Snippets Groups Projects
Commit c0a1a328 authored by Florent Gluck's avatar Florent Gluck
Browse files

Added comments to the extractArgs function as the splitting algorithm is a bit unsual

parent e359e8df
Branches
No related tags found
No related merge requests found
...@@ -28,10 +28,7 @@ var cmdList = []cmd.Command { ...@@ -28,10 +28,7 @@ var cmdList = []cmd.Command {
&cmdUser.UpdatePwd{"passwd"}, &cmdUser.UpdatePwd{"passwd"},
&cmdUser.List{"userlist"}, &cmdUser.List{"userlist"},
&cmdUser.Add{"useradd"}, &cmdUser.Add{"useradd"},
&cmdUser.Del{"userdel"}, &cmdUser.Del{"userdel"},PrintlnErr
&cmdUser.SetCaps{"usersetcaps"},
&cmdVM.List{"vmlist"},
&cmdVM.ListStart{"vmliststart"}, &cmdVM.ListStart{"vmliststart"},
&cmdVM.ListAttach{"vmlistattach"}, &cmdVM.ListAttach{"vmlistattach"},
&cmdVM.ListStop{"vmliststop"}, &cmdVM.ListStop{"vmliststop"},
...@@ -236,6 +233,11 @@ func extractArgs(line string) ([]string, error) { ...@@ -236,6 +233,11 @@ func extractArgs(line string) ([]string, error) {
for _, c := range line { for _, c := range line {
if c == ' ' { if c == ' ' {
if toggleReplace { if toggleReplace {
// IMPORTANT:
// The rune below is used to replace spaces within quotes in order
// to split the string on spaces as normal. Then, after the split,
// we simply replace the rune with spaces.
// Consequently the input string MUST NOT contain this specific rune!
sb.WriteRune('妖') sb.WriteRune('妖')
} else { } else {
sb.WriteRune(c) sb.WriteRune(c)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment