sorters

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnixPaths indicates that we are using unix-style paths.
	UnixPaths pathType = iota
	// WindowsPaths indicates that we are using Windows-style paths.
	WindowsPaths
)

Variables

View Source
var AvailableSorts = []Approach{
	{
		"text",
		"Sort the file as text according to the specified locale.",
		true,
		false,
		textSort,
	},
	{
		"numbered-text",
		"Sort the file assuming that each line starts with a numeric prefix," +
			" then fall back to sorting by text according to the specified locale.",
		true,
		false,
		numberedTextSort,
	},
	{
		"datetime-text",
		"Sort the file assuming that each line starts with a date or datetime prefix," +
			" then fall back to sorting by text according to the specified locale.",
		true,
		false,
		datetimeTextSort,
	},
	{
		"path",
		"Sort the file assuming that each line is a path," +
			" sorted so that deeper paths come after shorter.",
		true,
		true,
		pathSort,
	},
	{
		"ip",
		"Sort the file assuming that each line is an IP address.",
		false,
		false,
		ipSort,
	},
	{
		"network",
		"Sort the file assuming that each line is a network in CIDR form.",
		false,
		false,
		networkSort,
	},
}

AvailableSorts is a slice where each member is an Approach defining a single one of the available sort approaches.

Functions

This section is empty.

Types

type Approach

type Approach struct {
	Name             string
	Description      string
	SupportsLocale   bool
	SupportsPathType bool
	MakeSortFunc     sortFuncMaker
}

Approach defines a single sorting approach.

type SortParams

type SortParams struct {
	Locale          language.Tag
	CaseInsensitive bool
	Reverse         bool
	PathType        pathType
}

SortParams defines the common parameters for sort operations.

Jump to

Keyboard shortcuts

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