diff --git a/Makefile b/Makefile index 64168b0..b194e72 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,15 @@ vet: @GO111MODULE=off go vet @echo this go binary package builds okay -verbose: goimports vet plugin +verbose: goimports vet GO111MODULE=off go install -v -x \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -build: goimports vet plugin +build: goimports vet GO111MODULE=off go build -v -x \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -install: goimports vet plugin +install: goimports vet GO111MODULE=off go install \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" @@ -23,14 +23,10 @@ gemini: GO111MODULE=off go install \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -install-raw: goimports vet plugin +install-raw: goimports vet go install \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -plugin: - rm -f resources/*.so - # -cp ../../toolkits/gocui/gocui.so resources/ - andlabs: clean install gemini --gui gocui --gui-verbose --gui-file ../../toolkits/andlabs/andlabs.so @@ -49,3 +45,7 @@ clean: identify-protobuf: autogenpb --identify ~/.gemini/gemini.pb + + +playback: + gemini playback diff --git a/doPlayback.go b/doPlayback.go index 9ece30e..e636004 100644 --- a/doPlayback.go +++ b/doPlayback.go @@ -3,6 +3,7 @@ package main import ( "fmt" + "go.wit.com/lib/protobuf/chatpb" "go.wit.com/log" ) @@ -12,10 +13,24 @@ func doPlayback() { return } - log.Infof("Found %d chat topic(s) in the log.", len(me.chats.GetChats())) + listChats(me.chats) +} + +func showChat(uuid string) { + chat := me.chats.FindByUuid(uuid) + if chat == nil { + log.Info("unknown uuid", uuid) + return + } + // Call the new, dedicated formatting function. + prettyFormatChat(chat) +} + +func listChats(chats *chatpb.Chats) { + log.Infof("Found %d chat topic(s) in the log.", len(chats.GetChats())) fmt.Println("-------------------------------------------------") - for _, chat := range me.chats.GetChats() { + for _, chat := range chats.GetChats() { entryCount := len(chat.GetEntries()) var formattedTime string if ctime := chat.GetCtime(); ctime != nil { @@ -34,13 +49,3 @@ func doPlayback() { } fmt.Println("-------------------------------------------------") } - -func showChat(uuid string) { - chat := me.chats.FindByUuid(uuid) - if chat == nil { - log.Info("unknown uuid", uuid) - return - } - // Call the new, dedicated formatting function. - prettyFormatChat(chat) -} diff --git a/main.go b/main.go index 7d294f1..2f0b5ae 100644 --- a/main.go +++ b/main.go @@ -58,15 +58,14 @@ func main() { if err != nil { badExit(err) } + verifyUuids(newChats) + listChats(newChats) for _, newChat := range newChats.GetChats() { me.chats.AppendByUuid(newChat) } + listChats(me.chats) - // The verifyUuids function should be run on the main chats object - // after adding the new chats. - if verifyUuids(me.chats) { - me.chats.ConfigSave() - } + me.chats.ConfigSave() okExit("") }