Merge branch 'clifix' of cwtch.im/cwtch into master

这个提交包含在:
Dan Ballard 2018-08-04 22:09:33 +00:00 提交者 Gogs
当前提交 195278325b
共有 1 个文件被更改,包括 16 次插入6 次删除

查看文件

@ -66,14 +66,14 @@ func completer(d prompt.Document) []prompt.Suggest {
var s []prompt.Suggest
if app.Peer == nil {
return s
}
if d.FindStartOfPreviousWord() == 0 {
return prompt.FilterHasPrefix(suggestions, d.GetWordBeforeCursor(), true)
}
if app.Peer == nil {
return s
}
w := d.CurrentLine()
if strings.HasPrefix(w, "send") || strings.HasPrefix(w, "timeline") || strings.HasPrefix(w, "export-group") {
s = []prompt.Suggest{}
@ -202,9 +202,19 @@ func main() {
commands := strings.Split(text[0:], " ")
history = append(history, text)
if app.Peer == nil {
if commands[0] != "help" && commands[0] != "quit" && commands[0] != "new-profile" && commands[0] != "load-profile" {
fmt.Printf("Profile needs to be set\n")
continue
}
}
switch commands[0] {
case "quit":
app.Peer.Save()
if app.Peer != nil {
app.Peer.Save()
}
quit = true
case "new-profile":
if len(commands) == 2 {
@ -250,7 +260,7 @@ func main() {
if err == nil {
fmt.Printf("\nLoaded profile for %v\n", commands[1])
} else {
fmt.Printf("Error loading profile for %v: %v\n", commands[1], err)
fmt.Printf("\nError loading profile for %v: %v\n", commands[1], err)
}
} else {
fmt.Printf("Error Loading profile, usage: %s\n", usages["load-profile"])