File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ package main
99import (
1010 "flag"
1111 "fmt"
12- "io"
1312 "log"
1413 "os"
1514 "time"
1615
1716 "filippo.io/age/internal/age"
17+ "golang.org/x/crypto/ssh/terminal"
1818)
1919
2020func main () {
@@ -46,12 +46,16 @@ func main() {
4646 generate (out )
4747}
4848
49- func generate (out io. Writer ) {
49+ func generate (out * os. File ) {
5050 k , err := age .GenerateX25519Identity ()
5151 if err != nil {
5252 log .Fatalf ("Internal error: %v" , err )
5353 }
5454
55+ if ! terminal .IsTerminal (int (out .Fd ())) {
56+ fmt .Fprintf (os .Stderr , "Public key: %s\n " , k .Recipient ())
57+ }
58+
5559 fmt .Fprintf (out , "# created: %s\n " , time .Now ().Format (time .RFC3339 ))
5660 fmt .Fprintf (out , "# public key: %s\n " , k .Recipient ())
5761 fmt .Fprintf (out , "%s\n " , k )
You can’t perform that action at this time.
0 commit comments