|
6 | 6 | "errors"
|
7 | 7 | "fmt"
|
8 | 8 | "io"
|
9 |
| - "log" |
10 | 9 | "os"
|
11 | 10 | "time"
|
12 | 11 |
|
@@ -77,12 +76,16 @@ func printIter(w io.Writer, prettyOutput bool, iter iter.ResultIter[types.Record
|
77 | 76 | fmt.Fprintln(w, "\tAddresses:", record.Addrs)
|
78 | 77 |
|
79 | 78 | default:
|
80 |
| - // You may not want to fail here, it's up to you. You can just handle |
81 |
| - // the schemas you want, or that you know, but not fail. |
82 |
| - log.Printf("unrecognized schema: %s", res.Val.GetSchema()) |
| 79 | + // This is an unknown schema. Let's just print it raw. |
| 80 | + err := json.NewEncoder(w).Encode(res.Val) |
| 81 | + if err != nil { |
| 82 | + return err |
| 83 | + } |
83 | 84 | }
|
| 85 | + |
| 86 | + fmt.Fprintln(w) |
84 | 87 | } else {
|
85 |
| - err := json.NewEncoder(os.Stdout).Encode(res.Val) |
| 88 | + err := json.NewEncoder(w).Encode(res.Val) |
86 | 89 | if err != nil {
|
87 | 90 | return err
|
88 | 91 | }
|
@@ -125,12 +128,12 @@ func getIPNS(ctx context.Context, name ipns.Name, endpoint string, prettyOutput
|
125 | 128 | // do not need to verify it again. However, if you were not using this specific
|
126 | 129 | // client, but using some other tool, you should always validate the IPNS Record
|
127 | 130 | // using the [ipns.Validate] or [ipns.ValidateWithName] functions.
|
128 |
| - fmt.Println("\tSignature: VALID") |
| 131 | + fmt.Println("\tSignature Validated") |
129 | 132 | fmt.Println("\tValue:", v.String())
|
130 | 133 | fmt.Println("\tSequence:", seq)
|
| 134 | + fmt.Println("\tValidityType : EOL/End-of-Life") |
131 | 135 | fmt.Println("\tValidity:", eol.Format(time.RFC3339))
|
132 |
| - ttl, err := rec.TTL() |
133 |
| - if err == nil { |
| 136 | + if ttl, err := rec.TTL(); err == nil { |
134 | 137 | fmt.Println("\tTTL:", ttl.String())
|
135 | 138 | }
|
136 | 139 |
|
|
0 commit comments