Merge branch 'clifix' of cwtch.im/cwtch into master
This commit is contained in:
commit
195278325b
|
@ -66,14 +66,14 @@ func completer(d prompt.Document) []prompt.Suggest {
|
||||||
|
|
||||||
var s []prompt.Suggest
|
var s []prompt.Suggest
|
||||||
|
|
||||||
if app.Peer == nil {
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
if d.FindStartOfPreviousWord() == 0 {
|
if d.FindStartOfPreviousWord() == 0 {
|
||||||
return prompt.FilterHasPrefix(suggestions, d.GetWordBeforeCursor(), true)
|
return prompt.FilterHasPrefix(suggestions, d.GetWordBeforeCursor(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if app.Peer == nil {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
w := d.CurrentLine()
|
w := d.CurrentLine()
|
||||||
if strings.HasPrefix(w, "send") || strings.HasPrefix(w, "timeline") || strings.HasPrefix(w, "export-group") {
|
if strings.HasPrefix(w, "send") || strings.HasPrefix(w, "timeline") || strings.HasPrefix(w, "export-group") {
|
||||||
s = []prompt.Suggest{}
|
s = []prompt.Suggest{}
|
||||||
|
@ -202,9 +202,19 @@ func main() {
|
||||||
|
|
||||||
commands := strings.Split(text[0:], " ")
|
commands := strings.Split(text[0:], " ")
|
||||||
history = append(history, text)
|
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] {
|
switch commands[0] {
|
||||||
case "quit":
|
case "quit":
|
||||||
|
if app.Peer != nil {
|
||||||
app.Peer.Save()
|
app.Peer.Save()
|
||||||
|
}
|
||||||
quit = true
|
quit = true
|
||||||
case "new-profile":
|
case "new-profile":
|
||||||
if len(commands) == 2 {
|
if len(commands) == 2 {
|
||||||
|
@ -250,7 +260,7 @@ func main() {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Printf("\nLoaded profile for %v\n", commands[1])
|
fmt.Printf("\nLoaded profile for %v\n", commands[1])
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
fmt.Printf("Error Loading profile, usage: %s\n", usages["load-profile"])
|
fmt.Printf("Error Loading profile, usage: %s\n", usages["load-profile"])
|
||||||
|
|
Loading…
Reference in New Issue