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, rekeyCmd, sshCmd, configCmd) }