From 1a43826308b0d418cbea5ad53b18e36e22be64a3 Mon Sep 17 00:00:00 2001 From: Ezequiel Rosas Date: Tue, 13 Aug 2024 12:50:48 -0600 Subject: [PATCH 1/2] Make receive instructions copypaste-able --- src/croc/croc.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/croc/croc.go b/src/croc/croc.go index 88a4291..141afb4 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -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) From df5b2994f69f68fca361d2707d067e883dea2a56 Mon Sep 17 00:00:00 2001 From: vi'01-1'et <33045716+01-1@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:39:23 -0400 Subject: [PATCH 2/2] Update cli.go to use inline environment variables instead of export Also removed unnecessary quotes --- src/cli/cli.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cli/cli.go b/src/cli/cli.go index c695def..30c28f7 100644 --- a/src/cli/cli.go +++ b/src/cli/cli.go @@ -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: @@ -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: