hugoreleaser-plugins-api

module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0

README

Tests on Linux, MacOS and Windows Go Report Card GoDoc

Plugins API for https://github.com/gohugoio/hugoreleaser

A plugin is a Go Module with a main func, e.g., using the API provided by the archiveplugin package:

func main() {
	server, err := server.New(
		func(d server.Dispatcher, req archiveplugin.Request) archiveplugin.Response {
			d.Infof("Creating archive %s", req.OutFilename)

			if err := req.Init(); err != nil {
				// ... handle error.
			}

			if err := createArchive(req); err != nil {
				// ... handle error.
			}
			// Empty response is a success.
			return archiveplugin.Response{}
		},
	)
	if err != nil {
		log.Fatalf("Failed to create server: %s", err)
	}

	if err := server.Start(); err != nil {
		log.Fatalf("Failed to start server: %s", err)
	}

	_ = server.Wait()
}

See the Deb Plugin for a more complete example.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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