Categorygithub.com/Defacto2/releaser
repositorypackage
1.1.2
Repository: https://github.com/defacto2/releaser.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

Defacto2 / releaser

Go Reference Go Report Card

A Go library for handling the formatting of Defacto2 releasers. See the reference documentation for additional usage and examples.

Releasers are the groups or organisations that create the art, music, demos, intros, cracks, etc. that are found on the Defacto2 website. They are also the sites and boards that have hosted the files and communities.

Usage

In your Go project, import the releaser library.

package main

import (
	"fmt"
	"path"

	"github.com/Defacto2/releaser"
)

func main() {
	// Clean the the string releaser name.
	name := releaser.Clean("  the  knightmare  bbs ")
	fmt.Println(name) // Output: Knightmare BBS

	// Format the releaser name for use in a database cell.
	data := releaser.Cell("  the  knightmare  bbs ")
	fmt.Println(data) // Output: KNIGHTMARE BBS

	// Format the releaser name into a URL path.
	urlPath := releaser.Obfuscate("the knightmare bbs")
	fmt.Println(urlPath) // Output: knightmare-bbs

	// Format the releaser name into a human readable string.
	const url1 = "https://defacto2.net/g/knightmare-bbs"
	name = releaser.Humanize(path.Base(url1))
	fmt.Println(name) // Output: Knightmare BBS

	// Format the releaser names into a HTML link description.
	const url2 = "https://defacto2.net/g/class*paradigm*razor-1911"
	name = releaser.Link(path.Base(url2))
	fmt.Println(name) // Output: Class + Paradigm + Razor 1911
}