Hi,

*Purpose*

builds pipes to transform a data stream.
It comes with a generator to avoid you some copy paste, 
and provide a standard bytes stream to get started with []byte.

*Example*

Following example reads a source of []byte, os.Stdin, 
as a list of versions, one per line, 
manipulates and transforms the chunks 
until the data is written on the sink, os.Stdout.


//Package cmd implement a cli tool to manipulate Versions.
package main

import (
    "os"

    "github.com/mh-cbon/semver/cmd/stream"
)

func main() {

    src := os.Stdin

    pipeSrc := stream.NewByteReader(src)
    pipe := pipeSrc.
        Pipe(stream.NewBytesSplitter(' ', '\n')).
        Pipe(&stream.BytesTrimer{}).
        Pipe(&stream.VersionFromByte{SkipInvalid: true}).
        Pipe(&stream.VersionSorter{Asc: true}).
        Pipe(&stream.LastVersionOnly{}).
        Pipe(&stream.VersionToByte{}).
        Pipe(stream.NewBytesPrefixer("- ", "\n"))

    pipe.Sink(stream.NewByteSink(dest))

    if err := pipeSrc.Consume(); err != nil {
        panic(err)
    }
    os.Exit(0)
}


*URL*
https://mh-cbon.github.io/plumber/
https://github.com/mh-cbon/plumber

*WIP?*

yeah, let s write tests ect when its needed.


HTH

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to