- Add pop mail search CLI command with pagination support - Create internal/labels package with types and API client - Add folder list/create/update/delete CLI commands - Add label list/create/update/delete/apply/remove CLI commands - Register folder and label commands in root.go - Fix gopenpgp v2 API mismatches in pgp.go (NewPlainMessage, Armor, KeyRing.Encrypt/Decrypt, SessionKey) - Fix NewSessionManager error handling across cmd files - Fix variable shadowing bug in mail/client.go
48 lines
931 B
Go
48 lines
931 B
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 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())
|
|
|
|
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)
|
|
}
|
|
}
|