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
|
package main
import (
"os"
"github.com/spf13/cobra"
"gitlab.com/whiteboardguy/eno/internal/config"
)
var cobraCmd = &cobra.Command{
Use: "eno",
Short: "encrypted notes and file encryption tool",
}
var initCmd = &cobra.Command{
Use: "init",
Short: "intialize Eno config",
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
err := config.HandlerInit()
if err != nil {
cmd.PrintErrln("Error:", err)
os.Exit(1)
}
cmd.Println("Config initialized at ", config.Conf.ConfPath)
},
}
func init() {
encryptCmd.Flags().StringP("output", "o", "", "output file (required)")
encryptCmd.Flags().Bool("ssh", false, "encrypt using SSH public keys (interactive)")
// encryptCmd.MarkFlagRequired("output")
decryptCmd.Flags().StringP("output", "o", "", "output file (required)")
// decryptCmd.MarkFlagRequired("output")
newCmd.Flags().StringP("output", "o", "", "output file")
newCmd.Flags().BoolP("edit", "e", false, "edit after creation")
newCmd.Flags().Bool("ssh", false, "use your ssh for auth")
sshCmd.AddCommand(sshInitCmd)
configCmd.AddCommand(configSetCmd, configGetCmd, configListCmd, configRemoveCmd)
cobraCmd.AddCommand(encryptCmd, decryptCmd, initCmd, newCmd, editCmd, sshCmd, configCmd)
}
|