-
Notifications
You must be signed in to change notification settings - Fork 0
/
xipher.go
27 lines (25 loc) · 831 Bytes
/
xipher.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
package commands
import "github.com/spf13/cobra"
func XipherCommand() *cobra.Command {
if xipherCmd != nil {
return xipherCmd
}
xipherCmd = &cobra.Command{
Use: appName,
Short: "Xipher is a curated collection of cryptographic primitives put together to perform password-based asymmetric encryption. It is written in Go and can be used as a library or a CLI tool.",
Run: func(cmd *cobra.Command, args []string) {
version, _ := cmd.Flags().GetBool(versionFlag.name)
if version {
showVersionInfo()
} else {
cmd.Help()
}
},
}
xipherCmd.Flags().BoolP(versionFlag.name, versionFlag.shorthand, false, versionFlag.usage)
xipherCmd.AddCommand(versionCommand())
xipherCmd.AddCommand(keygenCommand())
xipherCmd.AddCommand(encryptCommand())
xipherCmd.AddCommand(decryptCommand())
return xipherCmd
}