mirror of
https://github.com/schollz/croc.git
synced 2024-11-24 08:02:33 +03:00
add colors
This commit is contained in:
parent
541ab998bd
commit
277e187abb
2
Gopkg.lock
generated
2
Gopkg.lock
generated
@ -184,6 +184,6 @@
|
|||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "cadd5f6ffb98a2a67dc6dcbec230d9c569a70eb9f9a1fb800281849bfb718c69"
|
inputs-digest = "2a7904ad8b3751617f1723e2d66b80203d1450df18b27439262ea385beac62b8"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
12
connect.go
12
connect.go
@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
"github.com/briandowns/spinner"
|
"github.com/briandowns/spinner"
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
|
"github.com/fatih/color"
|
||||||
homedir "github.com/mitchellh/go-homedir"
|
homedir "github.com/mitchellh/go-homedir"
|
||||||
"github.com/schollz/croc/keypair"
|
"github.com/schollz/croc/keypair"
|
||||||
"github.com/schollz/croc/randomstring"
|
"github.com/schollz/croc/randomstring"
|
||||||
@ -231,7 +232,10 @@ func (c *Connection) Run() error {
|
|||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(os.Stderr, "Sending %s file named '%s'\n", humanize.Bytes(uint64(c.File.Size)), c.File.Name)
|
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 = spinner.New(spinner.CharSets[24], 100*time.Millisecond) // Build our new spinner
|
||||||
c.spinner.Suffix = " Waiting for recipient.."
|
c.spinner.Suffix = " Waiting for recipient.."
|
||||||
c.spinner.Start()
|
c.spinner.Start()
|
||||||
@ -408,8 +412,10 @@ func (c *Connection) runClient(serverName string) error {
|
|||||||
// check if okay again
|
// check if okay again
|
||||||
if id == 0 {
|
if id == 0 {
|
||||||
c.spinner.Stop()
|
c.spinner.Stop()
|
||||||
fmt.Fprintf(os.Stderr, "Your public keyYour public key: %s\n", c.keypair.Public)
|
fmt.Fprintf(os.Stderr, "Your public key: ")
|
||||||
fmt.Fprintf(os.Stderr, "Recipient public key: %s\n", publicKeyRecipient)
|
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"
|
getOK := "y"
|
||||||
if !c.Yes {
|
if !c.Yes {
|
||||||
getOK = getInput("ok? (y/n): ")
|
getOK = getInput("ok? (y/n): ")
|
||||||
|
Loading…
Reference in New Issue
Block a user