plugincmds

package
v0.0.0-...-6e90ae1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNone = iota
	StatusDone
	StatusNotFound
)

Variables

View Source
var InstallCmd = &cobra.Command{
	Use:     "install [plugin url]",
	Short:   "Install a plugin",
	Long:    `Install a plugin given a link to the plugin's metadata JSON`,
	Args:    cobra.ExactArgs(1),
	Aliases: []string{"i", "in"},
	Run: func(cmd *cobra.Command, args []string) {
		validate := validator.New(validator.WithRequiredStructEnabled())
		err := validate.Var(args[0], "http_url")
		if err != nil {
			fmt.Println("Please enter a valid http url")
			os.Exit(1)
		}
		p := tea.NewProgram(initialInstallModel(args[0]))
		if model, err := p.Run(); err != nil {
			fmt.Printf("Alas, there's been an error: %v", err)
		} else if model, ok := model.(installModel); ok {
			fatalHandler.Handle(model.errorHandler)
		} else {
			log.Fatal("unexpected model type")
		}
	},
}
View Source
var RemoveCmd = &cobra.Command{
	Use:     "remove",
	Short:   "Remove a plugin",
	Long:    `Remove the plugin with the name specified`,
	Args:    cobra.ExactArgs(1),
	Aliases: []string{"r", "rm"},
	Run: func(cmd *cobra.Command, args []string) {
		p := tea.NewProgram(initialRemoveModel(args[0]))
		if model, err := p.Run(); err != nil {
			log.Fatal(err)
		} else if model, ok := model.(removeModel); ok {
			fatalHandler.Handle(model.errorHandler)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL