escape

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package escape provides percent and shell string escaping.

Index

Constants

View Source
const (
	PercentFilenames = PercentStrictness("-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz")
	PercentDocket    = PercentStrictness("+-.0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz")
)
View Source
const ShellSafe = "%+,-./0123456789:;=@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_abcdefghijklmnopqrstuvwxyz"

Variables

This section is empty.

Functions

func ForFilename

func ForFilename(raw string) string

ForFilename percent-encodes with a dash; its output always matches the regular expression `^[0-9A-Za-z-]*$`. ForFilename is injective.

func PercentDecode

func PercentDecode(raw string) ([]byte, error)

PercentDecode will upon encountering an encoding error emit utf8.RuneError and keep on going, returning a nil error iff no encoding error was encountered.

func PercentEncode

func PercentEncode(strictness PercentStrictness, raw []byte) string

func Shell

func Shell(raw string) string

Shell escapes any raw string to be correctly interpreted by a bash-like shell as one argument.

Types

type PercentStrictness

type PercentStrictness = string

Jump to

Keyboard shortcuts

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