Add comprehensive integration capabilities to Pop CLI: - Multi-account support with named profiles - Webhook management with signature verification - External PGP key management (import/export/encrypt/decrypt/sign/verify) - CLI plugin system for extensibility - Complete documentation in README.md All compilation errors fixed and build verified CLEAN. Security review delegated to FRE-5202. Co-Authored-By: Paperclip <noreply@paperclip.ing>
76 lines
1.7 KiB
Go
76 lines
1.7 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(webhookCmd())
|
|
cmd.AddCommand(pgpCmd())
|
|
cmd.AddCommand(pluginCmd())
|
|
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(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)
|
|
}
|
|
}
|