Skip to content

Commit

Permalink
Merge pull request #785 from nhtzr/feature/message
Browse files Browse the repository at this point in the history
Show recommended croc commands for both Windows and Linux/OSX
  • Loading branch information
schollz authored Aug 17, 2024
2 parents 69af916 + df5b299 commit d49aaa0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ func send(c *cli.Context) (err error) {
fmt.Printf(`On UNIX systems, to send with a custom code phrase,
you need to set the environmental variable CROC_SECRET:
export CROC_SECRET="****"
croc send file.txt
CROC_SECRET=**** croc send file.txt
Or you can have the code phrase automatically generated:
Expand Down Expand Up @@ -609,8 +608,7 @@ func receive(c *cli.Context) (err error) {
fmt.Printf(`On UNIX systems, to receive with croc you either need
to set a code phrase using your environmental variables:
export CROC_SECRET="****"
croc
CROC_SECRET=**** croc
Or you can specify the code phrase when you run croc without
declaring the secret on the command line:
Expand Down
9 changes: 8 additions & 1 deletion src/croc/croc.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,14 @@ func (c *Client) Send(filesInfo []FileInfo, emptyFoldersToTransfer []FileInfo, t
if c.Options.RelayPassword != models.DEFAULT_PASSPHRASE {
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 {
machid, _ := machineid.ID()
fmt.Fprintf(os.Stderr, "\rYour machine ID is '%s'\n", machid)
Expand Down

0 comments on commit d49aaa0

Please sign in to comment.