This commit is contained in:
Sarah Jamie Lewis 2018-05-02 23:01:15 -07:00
parent c2d349a817
commit 979ad542f7
4 changed files with 25 additions and 32 deletions

View File

@ -1,15 +1,13 @@
package main package main
import ( import (
"fmt" "fmt"
app2 "git.mascherari.press/cwtch/app" app2 "git.mascherari.press/cwtch/app"
"strings"
"github.com/c-bata/go-prompt" "github.com/c-bata/go-prompt"
"strings"
) )
var app app2.Application var app app2.Application
var suggestions = []prompt.Suggest{ var suggestions = []prompt.Suggest{
@ -99,7 +97,6 @@ func completer(d prompt.Document) []prompt.Suggest {
return s return s
} }
func main() { func main() {
cwtch := cwtch :=
@ -151,13 +148,11 @@ func main() {
} }
prmpt := fmt.Sprintf("cwtch [%v]> ", profile) prmpt := fmt.Sprintf("cwtch [%v]> ", profile)
text := prompt.Input(prmpt, completer, prompt.OptionSuggestionBGColor(prompt.Purple), text := prompt.Input(prmpt, completer, prompt.OptionSuggestionBGColor(prompt.Purple),
prompt.OptionDescriptionBGColor(prompt.White), prompt.OptionDescriptionBGColor(prompt.White),
prompt.OptionHistory(history)) prompt.OptionHistory(history))
commands := strings.Split(text[0:len(text)], " ") commands := strings.Split(text[0:], " ")
history = append(history, text) history = append(history, text)
switch commands[0] { switch commands[0] {
case "quit": case "quit":

View File

@ -23,7 +23,6 @@ func NewConnectionsManager() *Manager {
func (m *Manager) ManagePeerConnection(host string, profile *model.Profile) { func (m *Manager) ManagePeerConnection(host string, profile *model.Profile) {
m.lock.Lock() m.lock.Lock()
_, exists := m.peerConnections[host] _, exists := m.peerConnections[host]
if !exists { if !exists {
ppc := NewPeerPeerConnection(host, profile) ppc := NewPeerPeerConnection(host, profile)
@ -57,7 +56,6 @@ func (m *Manager) GetPeers() map[string]ConnectionState {
return rm return rm
} }
func (m *Manager) GetServers() map[string]ConnectionState { func (m *Manager) GetServers() map[string]ConnectionState {
rm := make(map[string]ConnectionState) rm := make(map[string]ConnectionState)
m.lock.Lock() m.lock.Lock()