File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,14 @@ File Location Subject
9797Found 140 certificates
9898` ` `
9999
100- # ## Global flags
100+ The ` --output` (or ` -o` ) flag allows specifying the output mode for export.
101+
102+ - ` --output pretty` is the default, and gives a table view of the data.
103+ - ` --output wide` also uses a table layout, but includes more infomation.
104+ - ` --output json` emits JSON.
105+ - ` --output pem` emits all full certificates in PEM format.
101106
102- ` -o --output ` : Allows specification of the output mode. Supports ` pretty ` , ` wide ` , and ` json ` . Defaults to ` pretty ` .
107+ # ## Global flags
103108
104109` --platform` : Specifies the platform in the form ` os/arch[/variant][:osversion]` (e.g. ` linux/amd64` )
105110
Original file line number Diff line number Diff line change 66 "context"
77 "encoding/hex"
88 "encoding/json"
9+ "encoding/pem"
910 "fmt"
11+ "os"
1012 "time"
1113
1214 "github.com/fatih/color"
@@ -119,6 +121,13 @@ func newExport(ctx context.Context) *cobra.Command {
119121 }
120122
121123 fmt .Println (string (m ))
124+ } else if outOpts .Mode == options .OutputModePEM {
125+ for _ , cert := range parsedCertificates .Found {
126+ pem .Encode (os .Stdout , & pem.Block {
127+ Type : "CERTIFICATE" ,
128+ Bytes : cert .Certificate .Raw ,
129+ })
130+ }
122131 }
123132
124133 return nil
Original file line number Diff line number Diff line change @@ -13,9 +13,15 @@ const (
1313 OutputModePretty = "pretty"
1414 OutputModeJSON = "json"
1515 OutputModeWide = "wide"
16+ OutputModePEM = "pem"
1617)
1718
18- var outputModes = []string {OutputModePretty , OutputModeJSON , OutputModeWide }
19+ var outputModes = []string {
20+ OutputModePretty ,
21+ OutputModeJSON ,
22+ OutputModeWide ,
23+ OutputModePEM ,
24+ }
1925
2026// Output are options for configuring command outputs.
2127type Output struct {
You can’t perform that action at this time.
0 commit comments