tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base64Tool

type Base64Tool struct{}

Base64Tool provides metadata for the Base64 encode/decode tool.

func (Base64Tool) Category

func (b Base64Tool) Category() string

func (Base64Tool) Description

func (b Base64Tool) Description() string

func (Base64Tool) DetectFromClipboard

func (b Base64Tool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s looks like a valid Base64-encoded string. Requires standard alphabet only, minimum 4 characters, and length divisible by 4.

func (Base64Tool) ID

func (b Base64Tool) ID() string

func (Base64Tool) Keywords

func (b Base64Tool) Keywords() []string

func (Base64Tool) Name

func (b Base64Tool) Name() string

type CSVTool

type CSVTool struct{}

CSVTool provides metadata for the JSON/CSV converter tool.

func (CSVTool) Category

func (CSVTool) Category() string

func (CSVTool) Description

func (CSVTool) Description() string

func (CSVTool) DetectFromClipboard

func (CSVTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false — conversion requires explicit action.

func (CSVTool) ID

func (CSVTool) ID() string

func (CSVTool) Keywords

func (CSVTool) Keywords() []string

func (CSVTool) Name

func (CSVTool) Name() string

type ColorTool

type ColorTool struct{}

ColorTool provides metadata for the Color Converter tool.

func (ColorTool) Category

func (c ColorTool) Category() string

func (ColorTool) Description

func (c ColorTool) Description() string

func (ColorTool) DetectFromClipboard

func (c ColorTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s looks like a color value.

func (ColorTool) ID

func (c ColorTool) ID() string

func (ColorTool) Keywords

func (c ColorTool) Keywords() []string

func (ColorTool) Name

func (c ColorTool) Name() string

type CronTool

type CronTool struct{}

CronTool provides metadata for the Cron Expression Parser tool.

func (CronTool) Category

func (c CronTool) Category() string

func (CronTool) Description

func (c CronTool) Description() string

func (CronTool) DetectFromClipboard

func (c CronTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s looks like a 5-field cron expression.

func (CronTool) ID

func (c CronTool) ID() string

func (CronTool) Keywords

func (c CronTool) Keywords() []string

func (CronTool) Name

func (c CronTool) Name() string

type DiffTool

type DiffTool struct{}

DiffTool provides metadata for the Text Diff tool.

func (DiffTool) Category

func (DiffTool) Category() string

func (DiffTool) Description

func (DiffTool) Description() string

func (DiffTool) DetectFromClipboard

func (DiffTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false because diff requires two inputs.

func (DiffTool) ID

func (DiffTool) ID() string

func (DiffTool) Keywords

func (DiffTool) Keywords() []string

func (DiffTool) Name

func (DiffTool) Name() string

type GZipTool

type GZipTool struct{}

GZipTool provides metadata for the GZip Compress / Decompress tool.

func (GZipTool) Category

func (g GZipTool) Category() string

func (GZipTool) Description

func (g GZipTool) Description() string

func (GZipTool) DetectFromClipboard

func (g GZipTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false because binary gzip detection from clipboard text is unreliable.

func (GZipTool) ID

func (g GZipTool) ID() string

func (GZipTool) Keywords

func (g GZipTool) Keywords() []string

func (GZipTool) Name

func (g GZipTool) Name() string

type HTMLEntityTool

type HTMLEntityTool struct{}

HTMLEntityTool provides metadata for the HTML Entity Encoder tool.

func (HTMLEntityTool) Category

func (h HTMLEntityTool) Category() string

func (HTMLEntityTool) Description

func (h HTMLEntityTool) Description() string

func (HTMLEntityTool) DetectFromClipboard

func (h HTMLEntityTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s contains HTML entity patterns such as &, <, >, ", or &#-prefixed sequences.

func (HTMLEntityTool) ID

func (h HTMLEntityTool) ID() string

func (HTMLEntityTool) Keywords

func (h HTMLEntityTool) Keywords() []string

func (HTMLEntityTool) Name

func (h HTMLEntityTool) Name() string

type HashTool

type HashTool struct{}

HashTool provides metadata for the Hash Generator tool.

func (HashTool) Category

func (h HashTool) Category() string

func (HashTool) Description

func (h HashTool) Description() string

func (HashTool) DetectFromClipboard

func (h HashTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false for the hash tool.

func (HashTool) ID

func (h HashTool) ID() string

func (HashTool) Keywords

func (h HashTool) Keywords() []string

func (HashTool) Name

func (h HashTool) Name() string

type JSONTool

type JSONTool struct{}

JSONTool provides JSON formatting, minification, and validation.

func (JSONTool) Category

func (JSONTool) Category() string

func (JSONTool) Description

func (JSONTool) Description() string

func (JSONTool) DetectFromClipboard

func (JSONTool) DetectFromClipboard(s string) bool

func (JSONTool) ID

func (JSONTool) ID() string

func (JSONTool) Keywords

func (JSONTool) Keywords() []string

func (JSONTool) Name

func (JSONTool) Name() string

type JWTDecodeResult

type JWTDecodeResult struct {
	Header    string
	Payload   string
	Signature string
	Output    string
	Error     string
}

JWTDecodeResult holds the decoded components of a JWT.

func JWTDecode

func JWTDecode(token string) JWTDecodeResult

JWTDecode splits a JWT into its three parts, base64url-decodes the header and payload, and pretty-prints the JSON.

type JWTTool

type JWTTool struct{}

JWTTool provides metadata for the JWT Decoder tool.

func (JWTTool) Category

func (j JWTTool) Category() string

func (JWTTool) Description

func (j JWTTool) Description() string

func (JWTTool) DetectFromClipboard

func (j JWTTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if the string looks like a JWT (3 dot-separated non-empty segments).

func (JWTTool) ID

func (j JWTTool) ID() string

func (JWTTool) Keywords

func (j JWTTool) Keywords() []string

func (JWTTool) Name

func (j JWTTool) Name() string

type LoremTool

type LoremTool struct{}

LoremTool provides metadata for the Lorem Ipsum Generator tool.

func (LoremTool) Category

func (l LoremTool) Category() string

func (LoremTool) Description

func (l LoremTool) Description() string

func (LoremTool) DetectFromClipboard

func (l LoremTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false for the lorem tool (generative tool).

func (LoremTool) ID

func (l LoremTool) ID() string

func (LoremTool) Keywords

func (l LoremTool) Keywords() []string

func (LoremTool) Name

func (l LoremTool) Name() string

type NumberBaseTool

type NumberBaseTool struct{}

NumberBaseTool provides metadata for the Number Base converter tool.

func (NumberBaseTool) Category

func (n NumberBaseTool) Category() string

func (NumberBaseTool) Description

func (n NumberBaseTool) Description() string

func (NumberBaseTool) DetectFromClipboard

func (n NumberBaseTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s has a 0x, 0b, or 0o prefix.

func (NumberBaseTool) ID

func (n NumberBaseTool) ID() string

func (NumberBaseTool) Keywords

func (n NumberBaseTool) Keywords() []string

func (NumberBaseTool) Name

func (n NumberBaseTool) Name() string

type PasswordTool

type PasswordTool struct{}

PasswordTool provides metadata for the Password Generator tool.

func (PasswordTool) Category

func (p PasswordTool) Category() string

func (PasswordTool) Description

func (p PasswordTool) Description() string

func (PasswordTool) DetectFromClipboard

func (p PasswordTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false for the password tool. Password generation is a generative tool with no meaningful clipboard detection.

func (PasswordTool) ID

func (p PasswordTool) ID() string

func (PasswordTool) Keywords

func (p PasswordTool) Keywords() []string

func (PasswordTool) Name

func (p PasswordTool) Name() string

type RegexTool

type RegexTool struct{}

RegexTool provides metadata for the Regex Tester tool.

func (RegexTool) Category

func (r RegexTool) Category() string

func (RegexTool) Description

func (r RegexTool) Description() string

func (RegexTool) DetectFromClipboard

func (r RegexTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false for the regex tool. Regex patterns are too ambiguous to detect reliably.

func (RegexTool) ID

func (r RegexTool) ID() string

func (RegexTool) Keywords

func (r RegexTool) Keywords() []string

func (RegexTool) Name

func (r RegexTool) Name() string

type Result

type Result struct {
	Output string
	Error  string
}

Result is the standard return type for tool operations. Success is indicated by Error == "".

func Base64Decode

func Base64Decode(input string, urlSafe bool) Result

Base64Decode decodes a Base64-encoded string. If urlSafe is true, RFC 4648 section 5 URL-safe decoding is used. It first tries decoding with padding, then without (stripping trailing =). On failure, it returns a Result with Error set.

func Base64Encode

func Base64Encode(input string, urlSafe bool, noPadding bool) Result

Base64Encode encodes the input string to Base64. If urlSafe is true, RFC 4648 section 5 URL-safe encoding is used. If noPadding is true, padding characters (=) are omitted.

func CSVToJSON

func CSVToJSON(input string, delimiter string) Result

CSVToJSON converts CSV text to a JSON array of objects. The first row is treated as headers. The delimiter parameter controls the field separator (default ",").

func ColorConvert

func ColorConvert(input string) Result

ColorConvert auto-detects the color format and converts to all formats.

func CronParse

func CronParse(expression string) Result

CronParse parses a 5-field cron expression and returns a human-readable description.

func DiffText

func DiffText(textA, textB string) Result

DiffText computes a unified diff between textA and textB using a longest common subsequence (LCS) algorithm. Lines present only in A are prefixed with "-", lines only in B with "+", and common lines with " ".

func GZipCompress

func GZipCompress(input string) Result

GZipCompress compresses the input string using gzip and returns the result as a base64-encoded string (since gzip output is binary).

func GZipDecompress

func GZipDecompress(input string) Result

GZipDecompress base64-decodes the input, then decompresses it with gzip. Returns the decompressed plaintext string.

func HTMLEntityDecode

func HTMLEntityDecode(input string) Result

HTMLEntityDecode decodes HTML entities in input using html.UnescapeString.

func HTMLEntityEncode

func HTMLEntityEncode(input string) Result

HTMLEntityEncode encodes special HTML characters in input using html.EscapeString.

func Hash

func Hash(input string, algorithm string, uppercase bool) Result

Hash computes the hash digest of input using the specified algorithm. Supported algorithms: md5, sha1, sha256, sha512 (case-insensitive). If uppercase is true, the hex-encoded output is returned in uppercase.

func JSONFormat

func JSONFormat(input string, indent int, sortKeys bool, useTabs bool) Result

JSONFormat pretty-prints JSON. When sortKeys is true, keys are sorted recursively. When useTabs is true, indentation uses tabs instead of spaces. Without sortKeys, json.Indent is used to preserve original key order.

func JSONMinify

func JSONMinify(input string) Result

JSONMinify removes all whitespace from JSON using json.Compact.

func JSONToCSV

func JSONToCSV(input string, delimiter string) Result

JSONToCSV converts a JSON array of objects to CSV text. The delimiter parameter controls the field separator (default ","). Keys are sorted alphabetically to produce deterministic output. Nested values are stringified as JSON.

func JSONToYAML

func JSONToYAML(input string) Result

JSONToYAML converts a JSON string to YAML.

func JSONValidate

func JSONValidate(input string) Result

JSONValidate checks whether the input is valid JSON. Returns Output "valid" on success, or Error with details on failure.

func JWTValidate

func JWTValidate(token string) Result

JWTValidate checks whether a token string is a structurally valid JWT. It verifies 3 dot-separated segments, valid base64url encoding, and valid JSON in the header and payload. Returns Output:"valid" on success or an Error.

func LoremGenerate

func LoremGenerate(words int, sentences int, paragraphs int) Result

LoremGenerate generates lorem ipsum placeholder text. Exactly one of words, sentences, or paragraphs must be > 0.

func NumberBaseConvert

func NumberBaseConvert(input string) Result

NumberBaseConvert auto-detects the number base from the input prefix and converts it to all four representations: decimal, hex, octal, binary. Prefixes: 0x = hex, 0b = binary, 0o = octal, else decimal.

func PasswordGenerate

func PasswordGenerate(length int, uppercase bool, lowercase bool, digits bool, symbols bool, symbolSet string) Result

PasswordGenerate creates a random password of the specified length using the selected character types. It uses crypto/rand for secure randomness. If symbolSet is empty, the default symbol set is used.

func RegexTest

func RegexTest(pattern string, input string, global bool) Result

RegexTest compiles pattern and tests it against input. If global is true, all matches are returned via FindAllString. If global is false, only the first match is returned via FindString.

func TextCaseConvert

func TextCaseConvert(input string, mode string) Result

TextCaseConvert converts the input text to the specified case mode. Supported modes: lower, upper, title, camel, snake, kebab.

func TextEscape

func TextEscape(input string) Result

TextEscape escapes special characters in the input string. It uses strconv.Quote and strips the surrounding quotes.

func TextStats

func TextStats(input string) Result

TextStats computes statistics about the input text: character count, word count, line count, sentence count, and byte count.

func TextUnescape

func TextUnescape(input string) Result

TextUnescape unescapes escape sequences in the input string. It replaces literal \n, \t, etc. with the actual characters. Uses strconv.Unquote, wrapping the input in quotes if needed.

func TimestampFromUnix

func TimestampFromUnix(input string, tz string) Result

TimestampFromUnix converts a unix timestamp (seconds or milliseconds) to a human-readable datetime in the specified timezone. If tz is empty, UTC is used. Input of 10 digits is treated as seconds, 13 digits as milliseconds.

func TimestampNow

func TimestampNow(tz string) Result

TimestampNow returns the current time in multiple formats. If tz is empty, UTC is used.

func TimestampToUnix

func TimestampToUnix(input string, millis bool) Result

TimestampToUnix parses a datetime string in RFC3339 or common formats and returns the unix timestamp. If millis is true, returns milliseconds.

func URLDecode

func URLDecode(input string) Result

URLDecode decodes a percent-encoded string. It handles both %20 and + as spaces.

func URLEncode

func URLEncode(input string, component bool) Result

URLEncode percent-encodes the input string. If component is true, url.QueryEscape is used (spaces become +). If component is false, url.PathEscape is used (spaces become %20).

func UUIDGenerate

func UUIDGenerate(version int, uppercase bool, noHyphens bool) Result

UUIDGenerate creates a new UUID of the specified version. Supported versions: 4 (random), 7 (time-ordered). If uppercase is true, the output is uppercased. If noHyphens is true, hyphens are removed from the output.

func UUIDValidate

func UUIDValidate(input string) Result

UUIDValidate checks whether the input is a valid UUID. Returns "valid (version N)" on success or an Error.

func XMLFormat

func XMLFormat(input string) Result

XMLFormat pretty-prints XML with 2-space indentation. It decodes all tokens from the input and re-encodes them with indentation.

func XMLMinify

func XMLMinify(input string) Result

XMLMinify removes all unnecessary whitespace from XML. It decodes and re-encodes tokens with no indentation.

func YAMLToJSON

func YAMLToJSON(input string, compact bool) Result

YAMLToJSON converts a YAML string to JSON. If compact is true, the JSON output has no indentation.

type TextEscapeTool

type TextEscapeTool struct{}

TextEscapeTool provides metadata for the Text Escape / Unescape tool.

func (TextEscapeTool) Category

func (t TextEscapeTool) Category() string

func (TextEscapeTool) Description

func (t TextEscapeTool) Description() string

func (TextEscapeTool) DetectFromClipboard

func (t TextEscapeTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s contains literal escape sequences such as \n, \t, \r, \\, or \".

func (TextEscapeTool) ID

func (t TextEscapeTool) ID() string

func (TextEscapeTool) Keywords

func (t TextEscapeTool) Keywords() []string

func (TextEscapeTool) Name

func (t TextEscapeTool) Name() string

type TextStatsTool

type TextStatsTool struct{}

TextStatsTool provides metadata for the Text Analyzer tool.

func (TextStatsTool) Category

func (t TextStatsTool) Category() string

func (TextStatsTool) Description

func (t TextStatsTool) Description() string

func (TextStatsTool) DetectFromClipboard

func (t TextStatsTool) DetectFromClipboard(_ string) bool

DetectFromClipboard always returns false for the text stats tool.

func (TextStatsTool) ID

func (t TextStatsTool) ID() string

func (TextStatsTool) Keywords

func (t TextStatsTool) Keywords() []string

func (TextStatsTool) Name

func (t TextStatsTool) Name() string

type TimestampTool

type TimestampTool struct{}

TimestampTool provides metadata for the Timestamp converter tool.

func (TimestampTool) Category

func (ts TimestampTool) Category() string

func (TimestampTool) Description

func (ts TimestampTool) Description() string

func (TimestampTool) DetectFromClipboard

func (ts TimestampTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s is exactly 10 or 13 digits (unix seconds or millis).

func (TimestampTool) ID

func (ts TimestampTool) ID() string

func (TimestampTool) Keywords

func (ts TimestampTool) Keywords() []string

func (TimestampTool) Name

func (ts TimestampTool) Name() string

type Tool

type Tool interface {
	Name() string
	ID() string
	Description() string
	Category() string
	Keywords() []string
	DetectFromClipboard(s string) bool
}

Tool defines the metadata interface for tool discovery and routing. Tool logic lives in standalone functions, NOT on this interface.

type URLParseResult

type URLParseResult struct {
	Scheme   string
	Host     string
	Port     string
	Path     string
	Query    string
	Fragment string
	Params   map[string][]string
	Output   string
	Error    string
}

URLParseResult holds the parsed components of a URL.

func URLParse

func URLParse(input string) URLParseResult

URLParse parses a URL string into its components. Returns an error for empty input or URLs without a scheme.

type URLTool

type URLTool struct{}

URLTool provides metadata for the URL encode/decode/parse tool.

func (URLTool) Category

func (u URLTool) Category() string

func (URLTool) Description

func (u URLTool) Description() string

func (URLTool) DetectFromClipboard

func (u URLTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s looks like an HTTP or HTTPS URL.

func (URLTool) ID

func (u URLTool) ID() string

func (URLTool) Keywords

func (u URLTool) Keywords() []string

func (URLTool) Name

func (u URLTool) Name() string

type UUIDParseResult

type UUIDParseResult struct {
	UUID      string
	Version   int
	Variant   string
	Timestamp string
	Output    string
	Error     string
}

UUIDParseResult holds the parsed components of a UUID.

func UUIDParse

func UUIDParse(input string) UUIDParseResult

UUIDParse parses a UUID string and returns its components.

type UUIDTool

type UUIDTool struct{}

UUIDTool provides metadata for the UUID Generate / Validate / Parse tool.

func (UUIDTool) Category

func (u UUIDTool) Category() string

func (UUIDTool) Description

func (u UUIDTool) Description() string

func (UUIDTool) DetectFromClipboard

func (u UUIDTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if the string looks like a UUID.

func (UUIDTool) ID

func (u UUIDTool) ID() string

func (UUIDTool) Keywords

func (u UUIDTool) Keywords() []string

func (UUIDTool) Name

func (u UUIDTool) Name() string

type XMLTool

type XMLTool struct{}

XMLTool provides metadata for the XML Formatter tool.

func (XMLTool) Category

func (XMLTool) Category() string

func (XMLTool) Description

func (XMLTool) Description() string

func (XMLTool) DetectFromClipboard

func (XMLTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if the input looks like XML — starts with '<' and contains '>'.

func (XMLTool) ID

func (XMLTool) ID() string

func (XMLTool) Keywords

func (XMLTool) Keywords() []string

func (XMLTool) Name

func (XMLTool) Name() string

type YAMLTool

type YAMLTool struct{}

YAMLTool provides metadata for the JSON / YAML converter tool.

func (YAMLTool) Category

func (y YAMLTool) Category() string

func (YAMLTool) Description

func (y YAMLTool) Description() string

func (YAMLTool) DetectFromClipboard

func (y YAMLTool) DetectFromClipboard(s string) bool

DetectFromClipboard returns true if s looks like YAML (but not JSON). It tries to unmarshal as YAML, and rejects inputs that start with { or [ to avoid detecting JSON as YAML.

func (YAMLTool) ID

func (y YAMLTool) ID() string

func (YAMLTool) Keywords

func (y YAMLTool) Keywords() []string

func (YAMLTool) Name

func (y YAMLTool) Name() string

Jump to

Keyboard shortcuts

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