feat: implement Milestone 3 integration points
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>
This commit is contained in:
111
cmd/plugin.go
Normal file
111
cmd/plugin.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/frenocorp/pop/internal/plugin"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func pluginCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "plugin",
|
||||
Short: "Manage plugins",
|
||||
Long: `List, enable, disable, and manage plugins for the Pop CLI.`,
|
||||
}
|
||||
|
||||
cmd.AddCommand(pluginListCmd())
|
||||
cmd.AddCommand(pluginEnableCmd())
|
||||
cmd.AddCommand(pluginDisableCmd())
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func pluginListCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List all registered plugins",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
reg, err := plugin.NewPluginRegistry()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create plugin registry: %w", err)
|
||||
}
|
||||
|
||||
plugins, err := reg.ListPlugins()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list plugins: %w", err)
|
||||
}
|
||||
|
||||
if len(plugins) == 0 {
|
||||
fmt.Println("No plugins registered.")
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, p := range plugins {
|
||||
fmt.Printf("Name: %s\n Version: %s\n Description: %s\n Binary: %s\n\n",
|
||||
p.Name, p.Version, p.Description, p.Binary)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pluginEnableCmd() *cobra.Command {
|
||||
var name string
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "enable <name>",
|
||||
Short: "Enable a plugin",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
name = args[0]
|
||||
|
||||
reg, err := plugin.NewPluginRegistry()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create plugin registry: %w", err)
|
||||
}
|
||||
|
||||
if err := reg.EnablePlugin(name); err != nil {
|
||||
return fmt.Errorf("failed to enable plugin: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Enabled plugin: %s\n", name)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func pluginDisableCmd() *cobra.Command {
|
||||
var name string
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "disable <name>",
|
||||
Short: "Disable a plugin",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
name = args[0]
|
||||
|
||||
reg, err := plugin.NewPluginRegistry()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create plugin registry: %w", err)
|
||||
}
|
||||
|
||||
if err := reg.DisablePlugin(name); err != nil {
|
||||
return fmt.Errorf("failed to disable plugin: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Disabled plugin: %s\n", name)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func init() {
|
||||
_ = os.Getenv
|
||||
}
|
||||
Reference in New Issue
Block a user