├── .github
└── workflows
│ └── release.yml
├── .goreleaser.yaml
├── LICENSE
├── README.md
├── go.mod
├── go.sum
└── main.go
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: goreleaser
2 |
3 | on:
4 | push:
5 | # run only against tags
6 | tags:
7 | - '*'
8 |
9 | permissions:
10 | contents: write
11 | # packages: write
12 | # issues: write
13 |
14 | jobs:
15 | goreleaser:
16 | runs-on: ubuntu-latest
17 | steps:
18 | -
19 | name: Checkout
20 | uses: actions/checkout@v2
21 | with:
22 | fetch-depth: 0
23 | -
24 | name: Fetch all tags
25 | run: git fetch --force --tags
26 | -
27 | name: Set up Go
28 | uses: actions/setup-go@v2
29 | with:
30 | go-version: 1.18
31 | -
32 | name: Run GoReleaser
33 | uses: goreleaser/goreleaser-action@v2
34 | with:
35 | # either 'goreleaser' (default) or 'goreleaser-pro'
36 | distribution: goreleaser
37 | version: latest
38 | args: release --rm-dist
39 | env:
40 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 | # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
42 | # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
43 |
--------------------------------------------------------------------------------
/.goreleaser.yaml:
--------------------------------------------------------------------------------
1 | # This is an example .goreleaser.yml file with some sensible defaults.
2 | # Make sure to check the documentation at https://goreleaser.com
3 | before:
4 | hooks:
5 | # You may remove this if you don't use go modules.
6 | - go mod tidy
7 | # you may remove this if you don't need go generate
8 | - go generate ./...
9 | builds:
10 | - env:
11 | - CGO_ENABLED=0
12 | goos:
13 | - linux
14 | - windows
15 | - darwin
16 | ldflags:
17 | - -w -s -X main.appVersion={{.Version}} -X main.appRevision={{.ShortCommit}} -X main.appBuildDate={{.Date}}
18 | archives:
19 | - replacements:
20 | darwin: Darwin
21 | linux: Linux
22 | windows: Windows
23 | 386: i386
24 | amd64: x86_64
25 | format_overrides:
26 | - goos: windows
27 | format: zip
28 | checksum:
29 | name_template: 'checksums.txt'
30 | snapshot:
31 | name_template: "{{ incpatch .Version }}-next"
32 | changelog:
33 | sort: asc
34 | filters:
35 | exclude:
36 | - '^docs:'
37 | - '^test:'
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 sheepla
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.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # longgopher
4 |
5 | *looooooooooooooooooooong gopher!*
6 |
7 |
8 |
9 | ## 🤔 What's this?
10 |
11 | A command to show long gopher on your terminal! Inspired by: [mattn/longcat](https://github.com/mattn/longcat) 😺
12 |
13 |
14 |
15 | 
16 |
17 |
18 |
19 | ## 💻 Usage
20 |
21 | ```
22 | Usage of longgopher:
23 | -V show version
24 | -l int
25 | length of gopher's body (default 10)
26 | ```
27 |
28 | ## ⬇️ Installation
29 |
30 | ### Download Binary
31 |
32 | You can download binary from the release page.
33 |
34 | > [Latest Release](https://github.com/sheepla/longgopher/releases/latest)
35 |
36 | ### Build From Source
37 |
38 | ```
39 | go install github.com/sheepla/longgopher@latest
40 | ```
41 |
42 | ## 🌲 Derived Projects
43 |
44 | - 🐮 [syumai/longify](https://github.com/syumai/longify): A command to output longified any ascii art
45 | - 🦕 [arrow2nd/longdeno](https://github.com/arrow2nd/longdeno): Looooooooooooooooooooooooooooooooooooooooooooooong [Deno](https://deno.land)
46 | - 🦀 [ikanago/longferris](https://github.com/ikanago/longferris): Long [Ferris](https://github.com/ciusji/ferris) written in Rust
47 | - 🐍 [4513ECHO/longpython](https://github.com/4513ECHO/longpython): CLI tool to print long python
48 | - 🌊 [koutarn/longlongC](https://github.com/koutarn/longlongC): long long C written in C
49 | - ➕ [ma-tw/longcpp](https://github.com/ma-tw/longcpp): long long C++ written in C++
50 |
51 | *I'm looking forward to many derivative projects being created!*
52 |
53 | ## 📔 License
54 |
55 | [MIT](./LICENSE)
56 |
57 | ## 🐑 Author
58 |
59 | [Sheepla](https://github.com/sheepla)
60 |
61 |
62 | ## 🙋 Contributing
63 |
64 | Welcome! Welcome!
65 |
66 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/sheepla/longgopher
2 |
3 | go 1.18
4 |
5 | require github.com/fatih/color v1.13.0
6 |
7 | require (
8 | github.com/mattn/go-colorable v0.1.9 // indirect
9 | github.com/mattn/go-isatty v0.0.14 // indirect
10 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
11 | )
12 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
2 | github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
3 | github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
4 | github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
5 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
6 | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
7 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
8 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
11 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "bufio"
5 | "flag"
6 | "fmt"
7 | "strings"
8 |
9 | color "github.com/fatih/color"
10 | )
11 |
12 | var (
13 | appVersion = "unknown"
14 | appRevision = "unknown"
15 | appBuildDate = "unknown"
16 | )
17 |
18 | type asciiArt string
19 |
20 | type gopherAsciiArt struct {
21 | Head asciiArt
22 | Body asciiArt
23 | Leg asciiArt
24 | }
25 |
26 | var gopher = gopherAsciiArt{
27 | // height: 11
28 | Head: `
29 | CCCCCCCCCCCCCCCCCCCCCC
30 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC,
31 | CCCCCCCCWWWWWWWCCCCWWWWWWWCCCCCCCC
32 | CCCCCCWWBBWWWWWWCCWWBBWWWWCCCCCCC
33 | CCCCCCWBBWWWWWCCCCWBBWWWWCCCCC
34 | CCCCCCCCCCCCBBBBCCCCCCCCCCCCC
35 | CCCCCCCCCCCYYYYYYYYCCCCCCCCCCC
36 | CCCCCCCCCCCCCWWWWWCCCCCCCCCCCC
37 | YYYYYCCCCCCCCCCWWWCCCCCCCCCYYYYY
38 | YYYYYCCCCCCCCCCCCCCCCCCCCCCYYYYY
39 | `,
40 | Body: ` CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC `,
41 |
42 | // height: 2
43 | Leg: ` YYYYYYCCCCCCCCCCCCCCCCCCCYYYYYYY
44 | YYYYYCCCCCCCCCCCCCCCCCCCYYYYYY `,
45 | }
46 |
47 | var (
48 | cyan = color.New(color.Bold, color.FgHiCyan)
49 | black = color.New(color.Bold, color.FgHiBlack)
50 | white = color.New(color.Bold, color.FgHiWhite)
51 | yellow = color.New(color.Bold, color.FgHiYellow)
52 | )
53 |
54 | var stdout = bufio.NewWriter(color.Output)
55 |
56 | var (
57 | length int
58 | version bool
59 | )
60 |
61 | func main() {
62 | flag.IntVar(&length, "l", 10, "length of gopher's body")
63 | flag.BoolVar(&version, "V", false, "show version")
64 | flag.Parse()
65 | if version {
66 | fmt.Printf("v%s-%s\nBuild at %s\n", appVersion, appRevision, appBuildDate)
67 | return
68 | }
69 | printGopher(length)
70 | }
71 |
72 | func printGopher(length int) {
73 | head := gopher.Head.Colorize('C', cyan).Colorize('W', white).Colorize('B', black).Colorize('Y', yellow)
74 | body := gopher.Body.Colorize('C', cyan)
75 | leg := gopher.Leg.Colorize('C', cyan).Colorize('Y', yellow)
76 |
77 | fmt.Fprint(stdout, head)
78 | for i := 0; i < length; i++ {
79 | fmt.Fprintln(stdout, body)
80 | }
81 | fmt.Fprintln(stdout, leg)
82 | stdout.Flush()
83 | }
84 |
85 | func (a asciiArt) Colorize(char rune, color *color.Color) asciiArt {
86 | str := strings.Replace(
87 | string(a),
88 | string(char),
89 | color.Sprint("#"),
90 | -1,
91 | )
92 | return asciiArt(str)
93 | }
94 |
--------------------------------------------------------------------------------