add colors

This commit is contained in:
Zack Scholl 2018-06-26 09:09:25 -07:00
parent 541ab998bd
commit 277e187abb
2 changed files with 10 additions and 4 deletions

2
Gopkg.lock generated
View File

@ -184,6 +184,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "cadd5f6ffb98a2a67dc6dcbec230d9c569a70eb9f9a1fb800281849bfb718c69"
inputs-digest = "2a7904ad8b3751617f1723e2d66b80203d1450df18b27439262ea385beac62b8"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -20,6 +20,7 @@ import (
"github.com/briandowns/spinner"
"github.com/dustin/go-humanize"
"github.com/fatih/color"
homedir "github.com/mitchellh/go-homedir"
"github.com/schollz/croc/keypair"
"github.com/schollz/croc/randomstring"
@ -231,7 +232,10 @@ func (c *Connection) Run() error {
} else {
fmt.Fprintf(os.Stderr, "Sending %s file named '%s'\n", humanize.Bytes(uint64(c.File.Size)), c.File.Name)
}
fmt.Fprintf(os.Stderr, "Code is: %s\n\n", c.Code)
fmt.Fprintf(os.Stderr, "Code is: ")
color.New(color.FgHiGreen, color.Bold).Fprint(os.Stderr, c.Code)
fmt.Fprintf(os.Stderr, "\n\n")
c.spinner = spinner.New(spinner.CharSets[24], 100*time.Millisecond) // Build our new spinner
c.spinner.Suffix = " Waiting for recipient.."
c.spinner.Start()
@ -408,8 +412,10 @@ func (c *Connection) runClient(serverName string) error {
// check if okay again
if id == 0 {
c.spinner.Stop()
fmt.Fprintf(os.Stderr, "Your public keyYour public key: %s\n", c.keypair.Public)
fmt.Fprintf(os.Stderr, "Recipient public key: %s\n", publicKeyRecipient)
fmt.Fprintf(os.Stderr, "Your public key: ")
color.New(color.FgHiRed).Fprintln(os.Stderr, c.keypair.Public)
fmt.Fprintf(os.Stderr, "Recipient public key: ")
color.New(color.FgHiYellow).Fprintln(os.Stderr, publicKeyRecipient)
getOK := "y"
if !c.Yes {
getOK = getInput("ok? (y/n): ")