Skip to content

Commit

Permalink
Merge pull request #4 from hueristiq/dev
Browse files Browse the repository at this point in the history
Development v1.2.0
  • Loading branch information
enenumxela authored Feb 1, 2024
2 parents a824103 + b062cb0 commit 33f2345
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 79 deletions.
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ labels: 'Type: Bug'

<!-- ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION. -->

### `xbridge` version:
<!-- We only accept issues that are reproducible on the latest version of `xbridge`. -->
<!-- You can find the latest version of project at https://github.com/hueristiq/xbridge/releases/ -->
### `xstream` version:
<!-- We only accept issues that are reproducible on the latest version of `xstream`. -->
<!-- You can find the latest version of project at https://github.com/hueristiq/xstream/releases/ -->

### Current Behavior:
<!-- A concise description of what you're experiencing. -->
Expand All @@ -20,9 +20,9 @@ labels: 'Type: Bug'
### Steps To Reproduce:
<!--
Example: steps to reproduce the behavior:
1. Run 'xbridge ..'
1. Run 'xstream ..'
2. See error...
-->

### Anything else:
<!-- Links? References? Screnshots? Anything that will give us more contexbridge about the issue that you are encountering! -->
<!-- Links? References? Screnshots? Anything that will give us more contexstream about the issue that you are encountering! -->
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
-
name: Go build
run: go build -v .
working-directory: ./cmd/xbridge
working-directory: ./cmd/xstream
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ before:

builds:
-
id: xbridge-cli
main: cmd/xbridge/main.go
binary: xbridge
id: xstream-cli
main: cmd/xstream/main.go
binary: xstream

env:
- CGO_ENABLED=0
Expand Down Expand Up @@ -38,7 +38,7 @@ archives:
-
id: tgz
builds:
- xbridge-cli
- xstream-cli
format: tar.gz
format_overrides:
-
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Please review the following guidelines before contributing. Also, feel free to p

## Have a Question?

Please don't open a GitHub issue for questions about how to use `xbridge`, as the goal is to use issues for managing bugs and feature requests. Issues that are related to general support will be closed.
Please don't open a GitHub issue for questions about how to use `xstream`, as the goal is to use issues for managing bugs and feature requests. Issues that are related to general support will be closed.

## Found a Bug?

If you've identified a bug in `xbridge`, please [submit an issue](#create-an-issue) to our GitHub repo: [hueristiq/xbridge](https://github.com/hueristiq/xbridge/issues/new). Please also feel free to submit a [Pull Request](#pull-requests) with a fix for the bug!
If you've identified a bug in `xstream`, please [submit an issue](#create-an-issue) to our GitHub repo: [hueristiq/xstream](https://github.com/hueristiq/xstream/issues/new). Please also feel free to submit a [Pull Request](#pull-requests) with a fix for the bug!

## Have a Feature Request?

Expand All @@ -31,7 +31,7 @@ Assuming no existing issues exist, please ensure you include required informatio

We may have additional questions and will communicate through the GitHub issue, so please respond back to our questions to help reproduce and resolve the issue as quickly as possible.

New issues can be created with in our [GitHub repo](https://github.com/hueristiq/xbridge/issues/new).
New issues can be created with in our [GitHub repo](https://github.com/hueristiq/xstream/issues/new).

### Pull Requests

Expand All @@ -49,6 +49,6 @@ When submitting code, please make every effort to follow existing conventions an

### License

By contributing your code, you agree to license your contribution under the terms of the [MIT License](https://github.com/hueristiq/xbridge/blob/master/LICENSE).
By contributing your code, you agree to license your contribution under the terms of the [MIT License](https://github.com/hueristiq/xstream/blob/master/LICENSE).

All files are released with the MIT license.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ go-test:

.PHONY: go-build
go-build:
$(GOBUILD) $(GOFLAGS) -ldflags '$(LDFLAGS)' -o bin/xbridge cmd/xbridge/main.go
$(GOBUILD) $(GOFLAGS) -ldflags '$(LDFLAGS)' -o bin/xstream cmd/xstream/main.go

.PHONY: go-install
go-install:
Expand Down
79 changes: 39 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# xbridge
# xstream

![made with go](https://img.shields.io/badge/made%20with-Go-1E90FF.svg) [![go report card](https://goreportcard.com/badge/github.com/hueristiq/xbridge)](https://goreportcard.com/report/github.com/hueristiq/xbridge) [![release](https://img.shields.io/github/release/hueristiq/xbridge?style=flat&color=1E90FF)](https://github.com/hueristiq/xbridge/releases) [![open issues](https://img.shields.io/github/issues-raw/hueristiq/xbridge.svg?style=flat&color=1E90FF)](https://github.com/hueristiq/xbridge/issues?q=is:issue+is:open) [![closed issues](https://img.shields.io/github/issues-closed-raw/hueristiq/xbridge.svg?style=flat&color=1E90FF)](https://github.com/hueristiq/xbridge/issues?q=is:issue+is:closed) [![license](https://img.shields.io/badge/license-MIT-gray.svg?color=1E90FF)](https://github.com/hueristiq/xbridge/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/xbridge/blob/master/CONTRIBUTING.md)
![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)

`xbridge` 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 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.

## Resources

Expand All @@ -25,53 +25,53 @@
## Features

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

## Installation

### Install release binaries (Without Go Installed)

Visit the [releases page](https://github.com/hueristiq/xbridge/releases) and find the appropriate archive for your operating system and architecture. Download the archive from your browser or copy its URL and retrieve it with `wget` or `curl`:
Visit the [releases page](https://github.com/hueristiq/xstream/releases) and find the appropriate archive for your operating system and architecture. Download the archive from your browser or copy its URL and retrieve it with `wget` or `curl`:

* ...with `wget`:

```bash
wget https://github.com/hueristiq/xbridge/releases/download/v<version>/xbridge-<version>-linux-amd64.tar.gz
wget https://github.com/hueristiq/xstream/releases/download/v<version>/xstream-<version>-linux-amd64.tar.gz
```

* ...or, with `curl`:

```bash
curl -OL https://github.com/hueristiq/xbridge/releases/download/v<version>/xbridge-<version>-linux-amd64.tar.gz
curl -OL https://github.com/hueristiq/xstream/releases/download/v<version>/xstream-<version>-linux-amd64.tar.gz
```

...then, extract the binary:

```bash
tar xf xbridge-<version>-linux-amd64.tar.gz
tar xf xstream-<version>-linux-amd64.tar.gz
```

> [!TIP]
> The above steps, download and extract, can be combined into a single step with this onliner
>
> ```bash
> curl -sL https://github.com/hueristiq/xbridge/releases/download/v<version>/xbridge-<version>-linux-amd64.tar.gz | tar -xzv
> curl -sL https://github.com/hueristiq/xstream/releases/download/v<version>/xstream-<version>-linux-amd64.tar.gz | tar -xzv
> ```
> [!NOTE]
> On Windows systems, you should be able to double-click the zip archive to extract the `xbridge` executable.
> On Windows systems, you should be able to double-click the zip archive to extract the `xstream` executable.
...move the `xbridge` binary to somewhere in your `PATH`. For example, on GNU/Linux and OS X systems:
...move the `xstream` binary to somewhere in your `PATH`. For example, on GNU/Linux and OS X systems:
```bash
sudo mv xbridge /usr/local/bin/
sudo mv xstream /usr/local/bin/
```
> [!NOTE]
> Windows users can follow [How to: Add Tool Locations to the PATH Environment Variable](https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx) in order to add `xbridge` to their `PATH`.
> Windows users can follow [How to: Add Tool Locations to the PATH Environment Variable](https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx) in order to add `xstream` to their `PATH`.
### Install source (With Go Installed)

Expand All @@ -80,59 +80,58 @@ Before you install from source, you need to make sure that Go is installed on yo
#### `go install ...`

```bash
go install -v github.com/hueristiq/xbridge/cmd/xbridge@latest
go install -v github.com/hueristiq/xstream/cmd/xstream@latest
```

#### `go build ...` the development Version

* Clone the repository

```bash
git clone https://github.com/hueristiq/xbridge.git
git clone https://github.com/hueristiq/xstream.git
```

* Build the utility

```bash
cd xbridge/cmd/xbridge && \
cd xstream/cmd/xstream && \
go build .
```

* Move the `xbridge` binary to somewhere in your `PATH`. For example, on GNU/Linux and OS X systems:
* Move the `xstream` binary to somewhere in your `PATH`. For example, on GNU/Linux and OS X systems:

```bash
sudo mv xbridge /usr/local/bin/
sudo mv xstream /usr/local/bin/
```
> [!NOTE]
> Windows users can follow [How to: Add Tool Locations to the PATH Environment Variable](https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx) in order to add `xbridge` to their `PATH`.

Windows users can follow [How to: Add Tool Locations to the PATH Environment Variable](https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx) in order to add `xstream` to their `PATH`.


> [!CAUTION]
> While the development version is a good way to take a peek at `xbridge`'s latest features before they get released, be aware that it may have bugs. Officially released versions will generally be more stable.
> While the development version is a good way to take a peek at `xstream`'s latest features before they get released, be aware that it may have bugs. Officially released versions will generally be more stable.
## Usage

To display help message for `xbridge` use the `-h` flag:
To display help message for `xstream` use the `-h` flag:

```bash
xbridge -h
xstream -h
```

help message:

```
_ _ _
__ _| |__ _ __(_) __| | __ _ ___
\ \/ / '_ \| '__| |/ _` |/ _` |/ _ \
> <| |_) | | | | (_| | (_| | __/
/_/\_\_.__/|_| |_|\__,_|\__, |\___|
|___/
v0.1.0
_
__ _____| |_ _ __ ___ __ _ _ __ ___
\ \/ / __| __| '__/ _ \/ _` | '_ ` _ \
> <\__ \ |_| | | __/ (_| | | | | | |
/_/\_\___/\__|_| \___|\__,_|_| |_| |_|
v0.1.0
with <3 by Hueristiq Open Source
with <3 by Hueristiq Open Source
USAGE:
xbridge [OPTIONS]
xstream [OPTIONS]
INPUT:
--soak bool soak up all input before writing to file
Expand Down Expand Up @@ -167,7 +166,7 @@ three
four
five
➜ cat new-stuff.txt | xbridge stuff.txt --append --unique
➜ cat new-stuff.txt | xstream stuff.txt --append --unique
zero
four
five
Expand All @@ -185,7 +184,7 @@ five
Note that the new lines added to `stuff.txt` are also sent to `stdout`, this allows for them to be redirected to another file:

```
➜ cat new-stuff.txt | xbridge stuff.txt --append --unique > added-lines.txt
➜ cat new-stuff.txt | xstream stuff.txt --append --unique > added-lines.txt
➜ cat added-lines.txt
zero
four
Expand All @@ -205,7 +204,7 @@ four
five
five
➜ cat stuff.txt | xbridge stuff.txt --soak --unique
➜ cat stuff.txt | xstream stuff.txt --soak --unique
zero
one
two
Expand All @@ -227,19 +226,19 @@ Note the use of `--soak`, it makes the utility soak up all its input before writ

## Contributing

[Issues](https://github.com/hueristiq/xbridge/issues) and [Pull Requests](https://github.com/hueristiq/xbridge/pulls) are welcome! **Check out the [contribution guidelines.](https://github.com/hueristiq/xbridge/blob/master/CONTRIBUTING.md)**
[Issues](https://github.com/hueristiq/xstream/issues) and [Pull Requests](https://github.com/hueristiq/xstream/pulls) are welcome! **Check out the [contribution guidelines.](https://github.com/hueristiq/xstream/blob/master/CONTRIBUTING.md)**

## Licensing

This tool is distributed under the [MIT license](https://github.com/hueristiq/xbridge/blob/master/LICENSE).
This tool is distributed under the [MIT license](https://github.com/hueristiq/xstream/blob/master/LICENSE).

## Credits

### Contributors

Thanks to the amazing [contributors](https://github.com/hueristiq/xbridge/graphs/contributors) for keeping this project alive.
Thanks to the amazing [contributors](https://github.com/hueristiq/xstream/graphs/contributors) for keeping this project alive.

[![contributors](https://contrib.rocks/image?repo=hueristiq/xbridge&max=500)](https://github.com/hueristiq/xbridge/graphs/contributors)
[![contributors](https://contrib.rocks/image?repo=hueristiq/xstream&max=500)](https://github.com/hueristiq/xstream/graphs/contributors)

### Similar Projects

Expand Down
12 changes: 6 additions & 6 deletions cmd/xbridge/main.go → cmd/xstream/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"strings"

"github.com/hueristiq/hqgolog"
"github.com/hueristiq/xbridge/internal/configuration"
"github.com/hueristiq/xstream/internal/configuration"
"github.com/spf13/pflag"
)

var (
soak bool
trim bool
unique bool
uniqueDestination bool
appendToDestination bool
quiet bool
preview bool
Expand All @@ -25,7 +25,7 @@ var (
func init() {
pflag.BoolVar(&soak, "soak", false, "")
pflag.BoolVar(&trim, "trim", false, "")
pflag.BoolVarP(&unique, "unique", "u", false, "")
pflag.BoolVarP(&uniqueDestination, "unique", "u", false, "")
pflag.BoolVarP(&appendToDestination, "append", "a", false, "")
pflag.BoolVarP(&quiet, "quiet", "q", false, "")
pflag.BoolVarP(&preview, "preview", "p", false, "")
Expand Down Expand Up @@ -64,7 +64,7 @@ func main() {

uniqueDestinationLinesMap := map[string]bool{}

if destination != "" && unique && appendToDestination {
if destination != "" && uniqueDestination && appendToDestination {
uniqueDestinationLinesMap, err = readFileIntoMap(destination, trim)
if err != nil && !os.IsNotExist(err) {
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 unique {
if uniqueDestination {
if uniqueDestinationLinesMap[line] {
continue
}
Expand Down Expand Up @@ -130,7 +130,7 @@ func processInputInDefaultMode(uniqueDestinationLinesMap map[string]bool, destin
line = strings.TrimSpace(line)
}

if unique {
if uniqueDestination {
if uniqueDestinationLinesMap[line] {
continue
}
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hueristiq/xbridge
module github.com/hueristiq/xstream

go 1.21
go 1.21.0

require (
github.com/hueristiq/hqgolog v0.0.0-20230623113334-a6018965a34f
Expand All @@ -9,6 +9,6 @@ require (
)

require (
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ github.com/logrusorgru/aurora/v3 v3.0.0 h1:R6zcoZZbvVcGMvDCKo45A9U/lzYyzl5NfYIvz
github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
Loading

0 comments on commit 33f2345

Please sign in to comment.