1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-27 12:34:19 +03:00

Merge pull request #785 from nhtzr/feature/message

Show recommended croc commands for both Windows and Linux/OSX
This commit is contained in:
Zack 2024-08-16 20:47:04 -07:00 committed by GitHub
commit d49aaa05fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -392,8 +392,7 @@ func send(c *cli.Context) (err error) {
fmt.Printf(`On UNIX systems, to send with a custom code phrase, fmt.Printf(`On UNIX systems, to send with a custom code phrase,
you need to set the environmental variable CROC_SECRET: you need to set the environmental variable CROC_SECRET:
export CROC_SECRET="****" CROC_SECRET=**** croc send file.txt
croc send file.txt
Or you can have the code phrase automatically generated: Or you can have the code phrase automatically generated:
@ -609,8 +608,7 @@ func receive(c *cli.Context) (err error) {
fmt.Printf(`On UNIX systems, to receive with croc you either need fmt.Printf(`On UNIX systems, to receive with croc you either need
to set a code phrase using your environmental variables: to set a code phrase using your environmental variables:
export CROC_SECRET="****" CROC_SECRET=**** croc
croc
Or you can specify the code phrase when you run croc without Or you can specify the code phrase when you run croc without
declaring the secret on the command line: declaring the secret on the command line:

View File

@ -648,7 +648,14 @@ func (c *Client) Send(filesInfo []FileInfo, emptyFoldersToTransfer []FileInfo, t
if c.Options.RelayPassword != models.DEFAULT_PASSPHRASE { if c.Options.RelayPassword != models.DEFAULT_PASSPHRASE {
flags.WriteString("--pass " + c.Options.RelayPassword + " ") flags.WriteString("--pass " + c.Options.RelayPassword + " ")
} }
fmt.Fprintf(os.Stderr, "Code is: %[1]s\nOn the other computer run\n\ncroc %[2]s%[1]s\n", c.Options.SharedSecret, flags.String()) fmt.Fprintf(os.Stderr, `Code is: %[1]s
On the other computer run:
(For Windows)
croc %[2]s%[1]s
(For Linux/OSX)
CROC_SECRET=%[1]q croc %[2]s
`, c.Options.SharedSecret, flags.String())
if c.Options.Ask { if c.Options.Ask {
machid, _ := machineid.ID() machid, _ := machineid.ID()
fmt.Fprintf(os.Stderr, "\rYour machine ID is '%s'\n", machid) fmt.Fprintf(os.Stderr, "\rYour machine ID is '%s'\n", machid)