diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-22 21:51:29 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-22 21:51:29 +0200 |
| commit | d88661935fa2b6e2c0fe93345800113e1a71b451 (patch) | |
| tree | 0002f1152a4eebafee6e3dea4065964a50d786c0 /identity | |
| parent | deebd135ffcb1c167f12ecf2d4c0aebdc14cbc86 (diff) | |
docs
Diffstat (limited to 'identity')
| -rw-r--r-- | identity/identity.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/identity/identity.go b/identity/identity.go index 06bd421..e1cd74d 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -7,15 +7,18 @@ type Identity struct { Reduced string } +// I return whether the other identity "means the same" as this one func (i Identity) I(other Identity) bool { return i.Reduced == other.Reduced } +// Is returns whether the other string "means the same" as this one func (i Identity) Is(input string) bool { reduced := Reduce(input) return i.Reduced == reduced } +// New creates a new Identity with default reduction func New(input string) Identity { reduced := Reduce(input) return Identity{ @@ -25,6 +28,7 @@ func New(input string) Identity { } +// Reduce normalizes input (commands and filenames) to simplify them func Reduce(input string) string { reduced := input reduced = strings.TrimPrefix(input, ".") |
