-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
root.go
37 lines (32 loc) · 1.42 KB
/
root.go
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
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "tor-gencert",
Short: "Generate certs and keys for Tor directory authorities",
Long: "https://www.torproject.org/",
Run: func(cmd *cobra.Command, args []string) {},
}
func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()
rootCmd.Flags().StringS("a", "a", "", "advertise the address:port combination as this authority’s preferred directory port")
rootCmd.Flags().StringS("c", "c", "", "Write the certificate to the specified file")
rootCmd.Flags().Bool("create-identity-key", false, "Generate a new identity key")
rootCmd.Flags().BoolP("help", "h", false, "Display help text and exit")
rootCmd.Flags().StringS("i", "i", "", "Read the identity key from the specified file")
rootCmd.Flags().StringS("m", "m", "", "Number of months that the certificate should be valid")
rootCmd.Flags().String("passphrase-fd", "", "Filedescriptor to read the passphrase from")
rootCmd.Flags().BoolP("reuse", "r", false, "Generate a new certificate, but not a new signing key")
rootCmd.Flags().StringS("s", "s", "", "Write the signing key to the specified file")
rootCmd.Flags().BoolS("v", "v", false, "Display verbose output")
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"c": carapace.ActionFiles(),
"i": carapace.ActionFiles(),
"s": carapace.ActionFiles(),
})
}