Browse Source

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

pull/103/head
Dan Ballard Gogs 1 year ago
parent
commit
195278325b
1 changed files with 16 additions and 6 deletions
  1. +16
    -6
      app/cli/main.go

+ 16
- 6
app/cli/main.go View File

@@ -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"])


Loading…
Cancel
Save