- Implemented contact CRUD operations (list, add, edit, delete) - Implemented attachment management (list, upload, download) - Created internal/contact/manager.go for contact persistence - Created internal/attachment/manager.go for attachment storage - Added CLI commands in cmd/contacts.go and cmd/attachments.go - Integrated contact and attachment commands into root CLI Files: - internal/contact/types.go - Contact data models - internal/contact/manager.go - Contact CRUD operations - internal/attachment/manager.go - Attachment file operations - cmd/contacts.go - Contact CLI commands - cmd/attachments.go - Attachment CLI commands Contacts stored in ~/.config/pop/contacts.json Attachments stored in ~/.config/pop/attachments/
44 lines
799 B
Go
44 lines
799 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(contactCmd())
|
|
rootCmd.AddCommand(attachmentCmd())
|
|
|
|
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)
|
|
}
|
|
}
|