Files
pop/cmd/root.go
Michael Freno 2cffa1ead7 FRE-4680: Implement Milestone 2 advanced features
- Draft auto-save with configurable interval, status, and manual trigger
- Email template system (save, list, use, delete templates)
- Export messages to JSON, MBOX, or EML format
- Import messages from JSON files
- Register new commands (thread, bulk, export, import, autosave, template)
- Update README.md with documentation for all new commands

Build and tests pass clean.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-14 00:40:24 -04:00

85 lines
2.0 KiB
Go

package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "pop",
Short: "ProtonMail CLI tool",
Long: `pop is a CLI tool for interacting with ProtonMail.
It provides commands for managing emails, contacts, and attachments
with full PGP encryption support.`,
}
func newRootCmdBase() *cobra.Command {
cmd := &cobra.Command{
Use: "pop",
Short: "ProtonMail CLI tool",
Long: `pop is a CLI tool for interacting with ProtonMail.
It provides commands for managing emails, contacts, and attachments
with full PGP encryption support.`,
}
cmd.AddCommand(loginCmd())
cmd.AddCommand(logoutCmd())
cmd.AddCommand(sessionCmd())
cmd.AddCommand(mailCmd())
cmd.AddCommand(mailDraftCmd())
cmd.AddCommand(contactCmd())
cmd.AddCommand(attachmentCmd())
cmd.AddCommand(folderCmd())
cmd.AddCommand(labelCmd())
cmd.AddCommand(accountsCmd())
cmd.AddCommand(threadCmd())
cmd.AddCommand(bulkCmd())
cmd.AddCommand(exportCmd())
cmd.AddCommand(importCmd())
cmd.AddCommand(draftAutoSaveCmd())
cmd.AddCommand(draftTemplateCmd())
return cmd
}
func NewRootCmd() *cobra.Command {
rootCmd.AddCommand(loginCmd())
rootCmd.AddCommand(logoutCmd())
rootCmd.AddCommand(sessionCmd())
rootCmd.AddCommand(mailCmd())
rootCmd.AddCommand(mailDraftCmd())
rootCmd.AddCommand(contactCmd())
rootCmd.AddCommand(attachmentCmd())
rootCmd.AddCommand(folderCmd())
rootCmd.AddCommand(labelCmd())
rootCmd.AddCommand(accountsCmd())
rootCmd.AddCommand(threadCmd())
rootCmd.AddCommand(bulkCmd())
rootCmd.AddCommand(exportCmd())
rootCmd.AddCommand(importCmd())
rootCmd.AddCommand(draftAutoSaveCmd())
rootCmd.AddCommand(draftTemplateCmd())
rootCmd.AddCommand(webhookCmd())
rootCmd.AddCommand(pgpCmd())
rootCmd.AddCommand(pluginCmd())
return rootCmd
}
func init() {
cobra.OnInitialize(initConfig)
}
func initConfig() {
// Initialize config loading
// Config is loaded from ~/.config/pop/
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}