package cmd import ( "fmt" "github.com/spf13/cobra" ) const defaultKeySize = 32 var keySize int func init() { rootCmd.AddCommand(keyCmd) keyCmd.Flags().IntVar(&keySize, "size", defaultKeySize, "Length of the generated key") } var keyCmd = &cobra.Command{ Use: "key", Short: "Generate a new cryptographic key", Long: `Generate a new cryptographic key for use in Draft projects.`, Run: func(cmd *cobra.Command, args []string) { if cmd.Flags().Changed("size") && keySize < defaultKeySize { fmt.Printf("❌ Key size must be at least %d for adequate security.\n", defaultKeySize) return } key := randomString(keySize) fmt.Println("Generated Key:", key) }, }