-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
54 lines (46 loc) · 1.38 KB
/
main.go
File metadata and controls
54 lines (46 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
func main() {
var rootCmd = &cobra.Command{
Use: "devcert [space separated domain names]",
Short: "Self-signed trusted certificates for local development.",
Long: `Generate self-signed, trusted certificates for local development.`,
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
err := devcertExec(args)
return err
},
}
var infoCmd = &cobra.Command{
Use: "info [.crt file]",
Short: "Print the certificate information.",
Long: "Print out the certificate information that the .crt file contains.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
err := devcertInfo(args)
return err
},
}
// Add the info command to the CLI commands
rootCmd.AddCommand(infoCmd)
var uninstallCmd = &cobra.Command{
Use: "uninstall",
Short: "Uninstall devcert.",
Long: "Uninstall devcert, cleanup the CA and certificate files. This command uninstalls the devcert command,\nif you want to uninstall a crt file, remove it from the ~/.devcert folder.",
RunE: func(cmd *cobra.Command, args []string) error {
err := uninstallDevcert()
return err
},
}
// Add the uninstall command to the CLI commands
rootCmd.AddCommand(uninstallCmd)
err := rootCmd.Execute()
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
}