-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (34 loc) · 803 Bytes
/
main.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
38
39
40
41
42
package main
import (
"fmt"
"os"
"passgen/subcommands"
"github.com/spf13/cobra"
)
func main() {
var rootVersion bool
rootCmd := &cobra.Command{
Use: "passgen",
Short: "Password generator for your daily usage",
Long: "Password generator for your daily usage in all your apps and websites",
Run: func(cmd *cobra.Command, args []string) {
if rootVersion {
subcommands.Version.Run(cmd, args)
return
}
subcommands.Generate.Run(cmd, args)
},
}
rootCmd.Flags().BoolVarP(&rootVersion, "version", "V", false, "Print the version number of Passgen")
rootCmd.AddCommand(
subcommands.Generate,
subcommands.Wallet,
subcommands.Storage,
subcommands.Safety,
subcommands.Version,
)
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}