Skip to content

Commit c8dcde7

Browse files
committed
initial work
0 parents  commit c8dcde7

9 files changed

Lines changed: 466 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
version: 2.1
2+
executors:
3+
base:
4+
docker:
5+
- image: circleci/golang:1.12
6+
working_directory: /go/src/github.com/spatialcurrent/gocat
7+
jobs:
8+
pre_deps_golang:
9+
executor: base
10+
steps:
11+
- checkout
12+
- run: go get -d ./...
13+
- run: go get github.com/inconshreveable/mousetrap # for windows CLI builds
14+
- run: sudo chown -R circleci /go/src
15+
- save_cache:
16+
key: v1-go-src-{{ .Branch }}-{{ .Revision }}
17+
paths:
18+
- /go/src
19+
test:
20+
executor: base
21+
steps:
22+
- run: sudo chown -R circleci /go/src
23+
- restore_cache:
24+
keys:
25+
- v1-go-src-{{ .Branch }}-{{ .Revision }}
26+
- run:
27+
name: Get shadow
28+
command: go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
29+
- run:
30+
name: Install shadow
31+
command: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
32+
- run:
33+
name: Download and install errcheck
34+
command: go get -u github.com/kisielk/errcheck
35+
- run:
36+
name: Download and install misspell
37+
command: go get -u github.com/client9/misspell/cmd/misspell
38+
- run:
39+
name: Download and install ineffassign
40+
command: go get -u github.com/gordonklaus/ineffassign
41+
- run:
42+
name: Download and install staticheck
43+
command: go get -u honnef.co/go/tools/cmd/staticcheck
44+
- run: bash scripts/test.sh
45+
validate:
46+
executor: base
47+
steps:
48+
- run: sudo chown -R circleci /go/src
49+
- restore_cache:
50+
keys:
51+
- v1-go-src-{{ .Branch }}-{{ .Revision }}
52+
- run:
53+
name: Install Dig
54+
command: sudo apt update && sudo apt install dnsutils
55+
- run:
56+
name: "Update ~/.ssh/known_hosts"
57+
command: |
58+
mkdir ~/.ssh/
59+
touch ~/.ssh/known_hosts
60+
for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts
61+
- run: go get github.com/spatialcurrent/go-header/...
62+
- run: go install github.com/spatialcurrent/go-header/cmd/goheader
63+
- run: goheader fix --fix-year 2019 --exit-code-on-changes 1 --verbose
64+
build_cli:
65+
executor: base
66+
steps:
67+
- run: sudo chown -R circleci /go/src
68+
- restore_cache:
69+
keys:
70+
- v1-go-src-{{ .Branch }}-{{ .Revision }}
71+
- run: bash scripts/build_cli.sh
72+
- store_artifacts:
73+
path: bin
74+
destination: /
75+
workflows:
76+
main:
77+
jobs:
78+
- pre_deps_golang
79+
- test:
80+
requires:
81+
- pre_deps_golang
82+
- validate:
83+
requires:
84+
- pre_deps_golang
85+
- build_cli:
86+
requires:
87+
- pre_deps_golang

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
secret/
2+
bin/
3+
*.so
4+
*.h

AUTHORS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
gocat is maintained by Spatial Current, Inc.
2+
3+
Authors:
4+
5+
* Patrick Dufour (pjdufour)

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing to gocat
2+
3+
## Contributor License Agreement
4+
5+
Thank you for your interest in contributing. You will first need to agree to the license. Simply post the following paragraph, with "your name" and "your github account" substituted as needed, to the first issue [#1](https://github.com/spatialcurrent/gocat/issues/1). Otherwise, you can email us [here](mailto:opensource@spatialcurrent.io?subject=CLA).
6+
7+
I, **< YOUR NAME > (< YOUR GITHUB ACCOUNT >)**, agree to the license terms. My contributions to this repo are granted to **Spatial Current, Inc.** under a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license and/or copyright is transferred.
8+
9+
## Versioning
10+
11+
This program is released using semantic versioning.
12+
13+
- New flags that alter default behavior are major releases.
14+
- New flags that maintain the same default behavior are minor releases.
15+
- Upgrades of dependencies that don't alert default behavior are patch releases.
16+
17+
## Authors
18+
19+
See [AUTHORS](https://github.com/spatialcurrent/gocat/blob/master/AUTHORS) for a list of contributors.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Spatial Current, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# =================================================================
2+
#
3+
# Copyright (C) 2019 Spatial Current, Inc. - All Rights Reserved
4+
# Released as open source under the MIT License. See LICENSE file.
5+
#
6+
# =================================================================
7+
bin/gocat_darwin_amd64:
8+
GOOS=darwin GOARCH=amd64 go build -o bin/gocat_darwin_amd64 $$(go list ./...)
9+
10+
bin/gocat_linux_amd64:
11+
GOOS=linux GOARCH=amd64 go build -o bin/gocat_linux_amd64 $$(go list ./...)
12+
13+
bin/gocat_windows_amd64.exe:
14+
GOOS=windows GOARCH=amd64 go build -o bin/gocat_windows_amd64.exe $$(go list ./...)
15+
16+
bin/gocat_linux_arm64:
17+
GOOS=linux GOARCH=arm64 go build -o bin/gocat_linux_arm64 $$(go list ./...)
18+
19+
build: \
20+
bin/gocat_darwin_amd64 \
21+
bin/gocat_linux_amd64 \
22+
bin/gocat_windows_amd64.exe \
23+
bin/gocat_linux_arm64
24+
25+
fmt:
26+
go fmt $$(go list ./... )
27+
28+
install:
29+
go install $$(go list ./...)
30+
31+
test:
32+
bash scripts/test.sh
33+
34+
clean:
35+
rm -fr bin

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[![CircleCI](https://circleci.com/gh/spatialcurrent/gocat/tree/master.svg?style=svg)](https://circleci.com/gh/spatialcurrent/gocat/tree/master) [![Go Report Card](https://goreportcard.com/badge/spatialcurrent/gocat)](https://goreportcard.com/report/spatialcurrent/gocat) [![GoDoc](https://godoc.org/github.com/spatialcurrent/gocat?status.svg)](https://godoc.org/github.com/spatialcurrent/gocat) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://github.com/spatialcurrent/gocat/blob/master/LICENSE)
2+
3+
# gocat
4+
5+
# Description
6+
7+
**gocat** is a super simple command line program for concatenating files. **gocat** supports the following operating systems and architectures.
8+
9+
| GOOS | GOARCH |
10+
| ---- | ------ |
11+
| darwin | amd64 |
12+
| linux | amd64 |
13+
| windows | amd64 |
14+
| linux | arm64 |
15+
16+
# Installation
17+
18+
No installation is required. Just grab a [release](https://github.com/spatialcurrent/gocat/releases). You might want to rename your binary to just `gocat` (or `cat`) for convenience.
19+
20+
If you do have go already installed, you can just run using `go run main.go` or install with `bash scripts/install.sh`
21+
22+
# Usage
23+
24+
See the few examples below.
25+
26+
# Examples
27+
28+
**Shell**
29+
30+
```shell
31+
gocat "~/.bash_aliases" "~/.bashrc"
32+
```
33+
34+
**Remote File**
35+
36+
`gocat` arguments can point to remote files
37+
38+
```shell
39+
gocat https://spatialcurrent.io
40+
```
41+
42+
**All Files With Extension**
43+
44+
`gocat` will print every file given as a positional argument, which can be useful when looking through thousands of files.
45+
46+
```shell
47+
gocat $( find . -print | grep -i '.*[.]md')
48+
```
49+
50+
# Building
51+
52+
You can build all the released artifacts using `make build` or run the make target for a specific operating system and architecture.
53+
54+
# Testing
55+
56+
Run test using `bash scripts/test.sh` or `make test`, which runs unit tests, `go vet`, `go vet with shadow`, [errcheck](https://github.com/kisielk/errcheck), [ineffassign](https://github.com/gordonklaus/ineffassign), [staticcheck](https://staticcheck.io/), and [misspell](https://github.com/client9/misspell).
57+
58+
# Contributing
59+
60+
[Spatial Current, Inc.](https://spatialcurrent.io) is currently accepting pull requests for this repository. We'd love to have your contributions! Please see [Contributing.md](https://github.com/spatialcurrent/gocat/blob/master/CONTRIBUTING.md) for how to get started.
61+
62+
# License
63+
64+
This work is distributed under the **MIT License**. See **LICENSE** file.

0 commit comments

Comments
 (0)