- Set up Go module with Cobra CLI skeleton - Implemented login/logout/session commands with 2FA support - Created ProtonMail API client with rate limiting - Added config management for ~/.config/pop/ - Configured CI/CD pipeline with GitHub Actions - Added Makefile for build/test/lint targets Files: - main.go, go.mod, go.sum - cmd/root.go, cmd/auth.go - internal/auth/session.go - internal/config/config.go - internal/api/client.go - Makefile, README.md, .gitignore - .github/workflows/ci.yml
42 lines
728 B
Go
42 lines
728 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())
|
|
|
|
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)
|
|
}
|
|
}
|