mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-23 20:20:31 +03:00
apparently, we have another prefix
This commit is contained in:
parent
0b7f1c465f
commit
be6a0f69da
@ -29,6 +29,9 @@ func stripPrompt(s string) string {
|
||||
if endPos := strings.Index(s, "] "); endPos > 0 {
|
||||
return s[endPos+2:]
|
||||
}
|
||||
if strings.HasPrefix(s, "-> ") {
|
||||
return s[3:]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
@ -49,6 +52,10 @@ func TestStripPrompt(t *testing.T) {
|
||||
Input: "[foo] \x1b[6D\x1b[K-> From your friendly system.\r",
|
||||
Want: "From your friendly system.\r",
|
||||
},
|
||||
{
|
||||
Input: "-> Err: must be op.\r",
|
||||
Want: "Err: must be op.\r",
|
||||
},
|
||||
}
|
||||
|
||||
for i, tc := range tests {
|
||||
|
Loading…
x
Reference in New Issue
Block a user