Skip to content

Add Unique() filter method - #248

Merged
bitfield merged 2 commits into
bitfield:masterfrom
HakeemTheEmperor:feature/unique-filter
Sep 6, 2026
Merged

Add Unique() filter method#248
bitfield merged 2 commits into
bitfield:masterfrom
HakeemTheEmperor:feature/unique-filter

Conversation

@HakeemTheEmperor

Copy link
Copy Markdown
Contributor

Resolves #247

Changes Introduced

Adds a Unique() method to Pipe (using FilterScan) that collapses consecutive duplicate lines while maintaining chronological order and real-time streaming capability.

Testing

  • Added TestUnique in filters_test.go covering consecutive duplicates, non-consecutive duplicates, unchanged unique streams, and empty pipes.
  • Verified test coverage is 100%.

Example

script.Echo("a\na\nb\na\n").Unique().Stdout()
// Output:
// a
// b
// a

@bitfield
bitfield merged commit b3849c3 into bitfield:master Sep 6, 2026
8 checks passed
@bitfield

bitfield commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Great job, thanks @HakeemTheEmperor!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Add Uniq() filter method

2 participants