Skip to content

Commit

Permalink
Merge pull request #6 from hueristiq/dev
Browse files Browse the repository at this point in the history
Development v0.3.0
  • Loading branch information
enenumxela authored Feb 2, 2024
2 parents a2f2576 + 06c2af7 commit 0e40c5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![made with go](https://img.shields.io/badge/made%20with-Go-1E90FF.svg) [![go report card](https://goreportcard.com/badge/github.com/hueristiq/xstream)](https://goreportcard.com/report/github.com/hueristiq/xstream) [![release](https://img.shields.io/github/release/hueristiq/xstream?style=flat&color=1E90FF)](https://github.com/hueristiq/xstream/releases) [![open issues](https://img.shields.io/github/issues-raw/hueristiq/xstream.svg?style=flat&color=1E90FF)](https://github.com/hueristiq/xstream/issues?q=is:issue+is:open) [![closed issues](https://img.shields.io/github/issues-closed-raw/hueristiq/xstream.svg?style=flat&color=1E90FF)](https://github.com/hueristiq/xstream/issues?q=is:issue+is:closed) [![license](https://img.shields.io/badge/license-MIT-gray.svg?color=1E90FF)](https://github.com/hueristiq/xstream/blob/master/LICENSE) ![maintenance](https://img.shields.io/badge/maintained%3F-yes-1E90FF.svg) [![contribution](https://img.shields.io/badge/contributions-welcome-1E90FF.svg)](https://github.com/hueristiq/xstream/blob/master/CONTRIBUTING.md)

`xstream` is a command-line interface (CLI) utility for handling data streams in Unix-like environments. It serves as a pivotal link between standard input and dual outputs - standard output and a file.
`xstream` is a versatile command-line interface (CLI) utility for handling data streams in Unix-like environments. It serves as a crucial link between standard input and dual outputs, taking a single stream of input and splitting it into two outputs, one to the standard output and the other to a file simultaneously.

## Resources

Expand All @@ -26,7 +26,7 @@

* Writes incoming `stdin` to both `stdout` and file.
* Supports reading and writing to the same file.
* Supports appending desination.
* Supports appending and overwriting destination.
* Supports deduplication.
* Cross-Platform (Windows, Linux & macOS).

Expand Down Expand Up @@ -126,7 +126,7 @@ __ _____| |_ _ __ ___ __ _ _ __ ___
\ \/ / __| __| '__/ _ \/ _` | '_ ` _ \
> <\__ \ |_| | | __/ (_| | | | | | |
/_/\_\___/\__|_| \___|\__,_|_| |_| |_|
v0.2.0
v0.3.0
with <3 by Hueristiq Open Source
Expand Down
26 changes: 13 additions & 13 deletions cmd/xstream/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import (
)

var (
soak bool
trim bool
uniqueDestination bool
appendToDestination bool
quiet bool
preview bool
soak bool
trim bool
uniqueOutput bool
appendToOutput bool
quiet bool
preview bool
)

func init() {
pflag.BoolVar(&soak, "soak", false, "")
pflag.BoolVar(&trim, "trim", false, "")
pflag.BoolVarP(&uniqueDestination, "unique", "u", false, "")
pflag.BoolVarP(&appendToDestination, "append", "a", false, "")
pflag.BoolVarP(&uniqueOutput, "unique", "u", false, "")
pflag.BoolVarP(&appendToOutput, "append", "a", false, "")
pflag.BoolVarP(&quiet, "quiet", "q", false, "")
pflag.BoolVarP(&preview, "preview", "p", false, "")

Expand All @@ -41,7 +41,7 @@ func init() {
h += " --soak bool soak up all input before writing to file\n"

h += "\nMANIPULATION:\n"
h += " --trim bool enable leading and trailing whitespace trimming\n"
h += " --trim bool trim leading and trailing whitespace\n"

h += "\nOUTPUT:\n"
h += " -u, --unique bool output unique lines\n"
Expand All @@ -64,15 +64,15 @@ func main() {

uniqueDestinationLinesMap := map[string]bool{}

if destination != "" && uniqueDestination && appendToDestination {
if destination != "" && uniqueOutput && appendToOutput {
uniqueDestinationLinesMap, err = readFileIntoMap(destination, trim)
if err != nil && !os.IsNotExist(err) {
hqgolog.Fatal().Msg(err.Error())
}
}

if destination != "" && !preview {
writer, err = getWriteCloser(destination, appendToDestination)
writer, err = getWriteCloser(destination, appendToOutput)
if err != nil {
hqgolog.Fatal().Msg(err.Error())
}
Expand Down Expand Up @@ -100,7 +100,7 @@ func processInputInSoakMode(uniqueDestinationLinesMap map[string]bool, destinati
}

for _, line := range inputLinesSlice {
if uniqueDestination {
if uniqueOutput {
if uniqueDestinationLinesMap[line] {
continue
}
Expand Down Expand Up @@ -130,7 +130,7 @@ func processInputInDefaultMode(uniqueDestinationLinesMap map[string]bool, destin
line = strings.TrimSpace(line)
}

if uniqueDestination {
if uniqueOutput {
if uniqueDestinationLinesMap[line] {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion internal/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "github.com/logrusorgru/aurora/v3"

const (
NAME string = "xstream"
VERSION string = "0.2.0"
VERSION string = "0.3.0"
)

var BANNER = aurora.Sprintf(
Expand Down

0 comments on commit 0e40c5d

Please sign in to comment.