Skip to content

Commit

Permalink
Merge pull request #1929 from rsteube/add-mkcert
Browse files Browse the repository at this point in the history
added mkcert
  • Loading branch information
rsteube authored Oct 28, 2023
2 parents ea8463d + ae945dd commit 918bca2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
51 changes: 51 additions & 0 deletions completers/mkcert_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "mkcert",
Short: "simple tool for making locally-trusted development certificates",
Long: "https://github.com/FiloSottile/mkcert",
Run: func(cmd *cobra.Command, args []string) {},
}

func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().BoolS("CAROOT", "CAROOT", false, "Print the CA certificate and key storage location")
rootCmd.Flags().StringS("cert-file", "cert-file", "", "Customize the output paths")
rootCmd.Flags().BoolS("client", "client", false, "Generate a certificate for client authentication")
rootCmd.Flags().StringS("csr", "csr", "", "Generate a certificate based on the supplied CSR")
rootCmd.Flags().BoolS("ecdsa", "ecdsa", false, "Generate a certificate with an ECDSA key")
rootCmd.Flags().StringS("install", "install", "", "Install the local CA in the system trust store")
rootCmd.Flags().StringS("key-file", "key-file", "", "Customize the output paths")
rootCmd.Flags().StringS("p12-file", "p12-file", "", "Customize the output paths")
rootCmd.Flags().BoolS("pkcs12", "pkcs12", false, "Generate a \".p12\" PKCS #12 file, also know as a \".pfx\" file")
rootCmd.Flags().StringS("uninstall", "uninstall", "", "Uninstall the local CA (but do not delete it)")

for _, f := range []string{
"CAROOT",
"client",
"csr",
"ecdsa",
"key-file",
"p12-file",
"pkcs12",
"uninstall",
} {
rootCmd.MarkFlagsMutuallyExclusive("csr", f)
}

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"cert-file": carapace.ActionFiles(),
"csr": carapace.ActionFiles(),
"key-file": carapace.ActionFiles(),
"p12-file": carapace.ActionFiles(),
})
}
7 changes: 7 additions & 0 deletions completers/mkcert_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/rsteube/carapace-bin/completers/mkcert_completer/cmd"

func main() {
cmd.Execute()
}

0 comments on commit 918bca2

Please sign in to comment.