groups

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package groups deals with group names and their initialisms.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCJDir  = errors.New("cronjob directory does not exist")
	ErrCJFile = errors.New("cronjob file to save html does not exist")
	ErrCfg    = errors.New("the directory.html setting is empty")
)

Functions

func Contains added in v1.10.0

func Contains(x string, sorted []string) bool

Contains returns true whenever sorted contains x. The slice value must be stored in increasing order.

func Count added in v1.10.2

func Count(name string) (int, error)

Count returns the number of file entries associated with a named group.

func Cronjob

func Cronjob(force bool) error

Cronjob is used for system automation to generate dynamic HTML pages.

func Exact added in v1.10.0

func Exact(name string) (int, error)

Exact returns the number of file entries that match an exact named group. The casing is ignored, but comma separated multi-groups are not matched to their parents. The name "tristar" will match "Tristar" but will not match records using "Tristar, Red Sector Inc".

func Fix

func Fix() error

Fix any malformed group names found in the database.

func Format added in v1.10.0

func Format(name string) string

Format returns a copy of name with custom formatting.

func Initialism

func Initialism(name string) (string, error)

Initialism returns a named group initialism or acronym.

func List added in v1.10.0

func List() ([]string, int, error)

List returns all the distinct groups.

func MatchStdOut added in v1.10.0

func MatchStdOut() error

MatchStdOut scans over the groups and attempts to match possible misnamed duplicates. The results are printed to stdout in realtime.

func Slug

func Slug(s string) string

Slug takes a string and makes it into a URL friendly slug.

func SwapAll added in v1.10.0

func SwapAll(group, str, swap string) string

SwapAll finds all occurrences of str within a group name and replaces it with swap.

func SwapNumeral added in v1.10.0

func SwapNumeral(group string, i int) string

SwapNumeral finds any occurrences of i within a group name and swaps it for a cardinal number.

func SwapOne added in v1.10.0

func SwapOne(group, str, swap string) string

SwapOne finds the first occurrence of str within a group name and replaces it with swap.

func SwapOrdinal added in v1.10.0

func SwapOrdinal(group string, i int) string

SwapOrdinal finds any occurrences of i within a group name and swaps it for a ordinal number.

func SwapPrefix added in v1.10.0

func SwapPrefix(group, prefix, swap string) string

SwapPrefix replaces the prefix value at the start of a group name and replaces it with swap. An empty string is returned if the prefix does not exist in the name.

func SwapSuffix added in v1.10.0

func SwapSuffix(group, suffix, swap string) string

SwapSuffix replaces the suffix value at the end of a group name and replaces it with swap. An empty string is returned if the suffix does not exist in the name.

func TrimSP added in v1.10.0

func TrimSP(name string) (string, string, string)

TrimSP removes all spaces from a named group, BBS or FTP site. The first string returns the spaceless name. The second string returns a spaceless name appended with the plural "s". The third string is spaceless name appended with the plural "z".

func Update added in v1.10.0

func Update(newName, group string) (count int64, err error)

Update replaces all instances of the group name with the new group name.

func Variations

func Variations(name string) ([]string, error)

Variations creates format variations for a named group.

func Wheres

func Wheres() []string

Wheres are group categories.

Types

type Request

type Request request.Flags

Request flags for group functions.

func (Request) DataList

func (r Request) DataList(name string) error

DataList prints an auto-complete list for HTML input elements.

func (Request) HTML

func (r Request) HTML(name string) error

HTML prints a snippet listing links to each group, with an optional file count.

func (Request) Print

func (r Request) Print() (total int, err error)

Print a list of organisations or groups filtered by a name and summarizes the results.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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