Compare commits
33 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4da8cc39c3 | |||
| d28164f057 | |||
| bb25e984e2 | |||
| 755c1cf25b | |||
| ee17c8d2d9 | |||
| 9b16e5ed6e | |||
| 727027c43f | |||
| c319798d25 | |||
| f8cf0f9ad2 | |||
| 2718e85f23 | |||
| 90af33bec8 | |||
| d08610b863 | |||
| 15748f56cb | |||
| be808573cc | |||
| b91b374b96 | |||
| e74dd4bd9c | |||
| 9d1a031cea | |||
| ec7c5fe27c | |||
| e1a1447918 | |||
| e040f341c2 | |||
| 12756ad19d | |||
| a80970cdc9 | |||
| 62158f7d6d | |||
| 1b40b090dc | |||
| 825c66365a | |||
| 9c5d94b31b | |||
| 4cd2cf5a07 | |||
| c31104da84 | |||
| 96d3e2416e | |||
| 73ca0c6120 | |||
| 28f98c346e | |||
| 3d2f86d275 | |||
| bc04423125 |
14 changed files with 305 additions and 254 deletions
66
.github/workflows/CI.yml
vendored
66
.github/workflows/CI.yml
vendored
|
|
@ -1,66 +0,0 @@
|
||||||
name: CI
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
version:
|
|
||||||
- '1.0' # old LTS
|
|
||||||
- '1.6' # new LTS
|
|
||||||
- '1' # Latest stable
|
|
||||||
- 'nightly' # 'nuf said
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
arch:
|
|
||||||
- x64
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: julia-actions/setup-julia@v1
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
|
||||||
arch: ${{ matrix.arch }}
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
env:
|
|
||||||
cache-name: cache-artifacts
|
|
||||||
with:
|
|
||||||
path: ~/.julia/artifacts
|
|
||||||
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-test-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-test-
|
|
||||||
${{ runner.os }}-
|
|
||||||
- uses: julia-actions/julia-buildpkg@v1
|
|
||||||
- uses: julia-actions/julia-runtest@v1
|
|
||||||
- uses: julia-actions/julia-processcoverage@v1
|
|
||||||
- uses: codecov/codecov-action@v1
|
|
||||||
with:
|
|
||||||
file: lcov.info
|
|
||||||
docs:
|
|
||||||
name: Documentation
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: julia-actions/setup-julia@v1
|
|
||||||
with:
|
|
||||||
version: '1'
|
|
||||||
- run: |
|
|
||||||
julia --project=docs -e '
|
|
||||||
using Pkg
|
|
||||||
Pkg.develop(PackageSpec(path=pwd()))
|
|
||||||
Pkg.instantiate()'
|
|
||||||
- run: |
|
|
||||||
julia --project=docs -e '
|
|
||||||
using Documenter: DocMeta, doctest
|
|
||||||
using Cowsay
|
|
||||||
DocMeta.setdocmeta!(Cowsay, :DocTestSetup, :(using Cowsay); recursive=true)
|
|
||||||
doctest(Cowsay)'
|
|
||||||
- run: julia --project=docs docs/make.jl
|
|
||||||
env:
|
|
||||||
JULIA_PKG_SERVER: ""
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
|
|
||||||
16
.github/workflows/CompatHelper.yml
vendored
16
.github/workflows/CompatHelper.yml
vendored
|
|
@ -1,16 +0,0 @@
|
||||||
name: CompatHelper
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: 0 0 * * *
|
|
||||||
workflow_dispatch:
|
|
||||||
jobs:
|
|
||||||
CompatHelper:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Pkg.add("CompatHelper")
|
|
||||||
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
|
|
||||||
- name: CompatHelper.main()
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
|
|
||||||
run: julia -e 'using CompatHelper; CompatHelper.main()'
|
|
||||||
15
.github/workflows/TagBot.yml
vendored
15
.github/workflows/TagBot.yml
vendored
|
|
@ -1,15 +0,0 @@
|
||||||
name: TagBot
|
|
||||||
on:
|
|
||||||
issue_comment:
|
|
||||||
types:
|
|
||||||
- created
|
|
||||||
workflow_dispatch:
|
|
||||||
jobs:
|
|
||||||
TagBot:
|
|
||||||
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: JuliaRegistries/TagBot@v1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
ssh: ${{ secrets.DOCUMENTER_KEY }}
|
|
||||||
14
.github/workflows/register.yml
vendored
14
.github/workflows/register.yml
vendored
|
|
@ -1,14 +0,0 @@
|
||||||
name: Register Package
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: Version to register or component to bump
|
|
||||||
required: true
|
|
||||||
jobs:
|
|
||||||
register:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: julia-actions/RegisterAction@latest
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
37
.woodpecker.yaml
Normal file
37
.woodpecker.yaml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
matrix:
|
||||||
|
JULIA_VERSION:
|
||||||
|
- "1.0"
|
||||||
|
- "1.6"
|
||||||
|
- "1.10"
|
||||||
|
- "1"
|
||||||
|
- "rc"
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
settings:
|
||||||
|
partial: false
|
||||||
|
depth: 0
|
||||||
|
|
||||||
|
steps:
|
||||||
|
test:
|
||||||
|
image: julia:${JULIA_VERSION}
|
||||||
|
pull: true
|
||||||
|
when:
|
||||||
|
event: [pull_request, push]
|
||||||
|
commands:
|
||||||
|
- julia -e 'using Pkg; Pkg.activate(pwd()); Pkg.instantiate()'
|
||||||
|
- julia -e 'using Pkg; Pkg.activate(pwd()); Pkg.test()'
|
||||||
|
docs:
|
||||||
|
image: julia:${JULIA_VERSION}
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: push
|
||||||
|
matrix:
|
||||||
|
JULIA_VERSION: "1"
|
||||||
|
commands:
|
||||||
|
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
|
||||||
|
- julia --project=docs/ docs/make.jl
|
||||||
|
environment:
|
||||||
|
PROJECT_ACCESS_TOKEN:
|
||||||
|
from_secret: project_access_token
|
||||||
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -8,6 +8,16 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Cow "modes" (Borg, dead, greedy, etc.)
|
||||||
|
|
||||||
|
## [v0.3.1] - 2022-02-01
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Newlines in input message are no longer stripped out during text wrapping
|
||||||
|
|
||||||
## [v0.3.0] - 2022-02-01
|
## [v0.3.0] - 2022-02-01
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
@ -73,7 +83,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
- `cowsay` function for Julia in package format
|
- `cowsay` function for Julia in package format
|
||||||
|
|
||||||
[Unreleased]: https://github.com/MillironX/Cowsay.jl/compare/v0.3.0...HEAD
|
[unreleased]: https://github.com/MillironX/Cowsay.jl/compare/v0.3.1...HEAD
|
||||||
|
[v0.3.0]: https://github.com/MillironX/Cowsay.jl/compare/v0.3.0...v0.3.1
|
||||||
[v0.3.0]: https://github.com/MillironX/Cowsay.jl/compare/v0.2.1...v0.3.0
|
[v0.3.0]: https://github.com/MillironX/Cowsay.jl/compare/v0.2.1...v0.3.0
|
||||||
[v0.2.1]: https://github.com/MillironX/Cowsay.jl/compare/v0.2.0...v0.2.1
|
[v0.2.1]: https://github.com/MillironX/Cowsay.jl/compare/v0.2.0...v0.2.1
|
||||||
[v0.2.0]: https://github.com/MillironX/Cowsay.jl/compare/v0.1.0...v0.2.0
|
[v0.2.0]: https://github.com/MillironX/Cowsay.jl/compare/v0.1.0...v0.2.0
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
name = "Cowsay"
|
name = "Cowsay"
|
||||||
uuid = "b6370f49-8ad1-4651-ad9e-3639b35da0e9"
|
uuid = "b6370f49-8ad1-4651-ad9e-3639b35da0e9"
|
||||||
authors = ["Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> and contributors"]
|
authors = ["Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> and contributors"]
|
||||||
version = "0.3.0"
|
version = "1.0.0"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
TextWrap = "b718987f-49a8-5099-9789-dcd902bef87d"
|
TextWrap = "b718987f-49a8-5099-9789-dcd902bef87d"
|
||||||
|
|
||||||
[compat]
|
[compat]
|
||||||
julia = "1"
|
|
||||||
TextWrap = "1"
|
TextWrap = "1"
|
||||||
|
julia = "1"
|
||||||
|
|
||||||
[extras]
|
[extras]
|
||||||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
||||||
|
|
|
||||||
56
README.md
56
README.md
|
|
@ -15,6 +15,7 @@
|
||||||
[](https://millironx.com/Cowsay.jl/dev)
|
[](https://millironx.com/Cowsay.jl/dev)
|
||||||
[](https://github.com/MillironX/Cowsay.jl/actions)
|
[](https://github.com/MillironX/Cowsay.jl/actions)
|
||||||
[](https://codecov.io/gh/MillironX/Cowsay.jl)
|
[](https://codecov.io/gh/MillironX/Cowsay.jl)
|
||||||
|
[](https://pkgs.genieframework.com?packages=Cowsay)
|
||||||
|
|
||||||
A talking cow library for Julia, based on the [Fedora release of
|
A talking cow library for Julia, based on the [Fedora release of
|
||||||
cowsay](https://src.fedoraproject.org/rpms/cowsay).
|
cowsay](https://src.fedoraproject.org/rpms/cowsay).
|
||||||
|
|
@ -32,7 +33,7 @@ add Cowsay
|
||||||
|
|
||||||
Complete usage info can be found in [the documentation]. Cowsay.jl exports two
|
Complete usage info can be found in [the documentation]. Cowsay.jl exports two
|
||||||
functions: `cowsay` and `cowthink`, which print an ASCII cow saying or thinking
|
functions: `cowsay` and `cowthink`, which print an ASCII cow saying or thinking
|
||||||
a message without text wrapping, respectively.
|
a message, respectively.
|
||||||
|
|
||||||
```julia-repl
|
```julia-repl
|
||||||
julia> using Cowsay
|
julia> using Cowsay
|
||||||
|
|
@ -59,14 +60,32 @@ julia> cowthink("The farmers who have no livestock,\ntheir lives simply aren't t
|
||||||
|| ||
|
|| ||
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to use talking cows in your program, use the `cowsaid` and
|
||||||
|
`cowthunk` functions to get strings of the cow art.
|
||||||
|
|
||||||
|
```julia-repl
|
||||||
|
julia> @info string("\n", cowsaid("And the longhorns lowed him a welcome\nAs a new voice cried from the buckboard"))
|
||||||
|
┌ Info:
|
||||||
|
│ _________________________________________
|
||||||
|
│ / And the longhorns lowed him a welcome \
|
||||||
|
│ \ As a new voice cried from the buckboard /
|
||||||
|
│ -----------------------------------------
|
||||||
|
│ \ ^__^
|
||||||
|
│ \ (oo)\_______
|
||||||
|
│ (__)\ )\/\
|
||||||
|
│ ||----w |
|
||||||
|
└ || ||
|
||||||
|
```
|
||||||
|
|
||||||
There are also plenty of [unexported Cowfiles] that you can use to customize
|
There are also plenty of [unexported Cowfiles] that you can use to customize
|
||||||
your art.
|
your art.
|
||||||
|
|
||||||
```julia-repl
|
```julia-repl
|
||||||
julia> cowsay("Super cattle growth hormone can make your beef delicious", cow=Cowsay.udder)
|
julia> cowsay("This heifer must be empty\n'Cuz she ain't puttin' out", cow=Cowsay.udder)
|
||||||
__________________________________________________________
|
____________________________
|
||||||
< Super cattle growth hormone can make your beef delicious >
|
/ This heifer must be empty \
|
||||||
----------------------------------------------------------
|
\ 'Cuz she ain't puttin' out /
|
||||||
|
----------------------------
|
||||||
\
|
\
|
||||||
\ (__)
|
\ (__)
|
||||||
o o\
|
o o\
|
||||||
|
|
@ -93,7 +112,30 @@ julia> cowsay("You better watch your step\nwhen you know the chips are down!", t
|
||||||
|| ||
|
|| ||
|
||||||
```
|
```
|
||||||
|
|
||||||
[Julia REPL]: https://docs.julialang.org/en/v1/manual/getting-started/
|
And even change its emotional or physical state using modes.
|
||||||
|
|
||||||
|
```julia-repl
|
||||||
|
julia> cowsay("He mooed we must fight\nEscape or we'll die\nCows gathered around\n'Cause the steaks were so high"; dead=true)
|
||||||
|
________________________________
|
||||||
|
/ He mooed we must fight \
|
||||||
|
| Escape or we'll die |
|
||||||
|
| Cows gathered around |
|
||||||
|
\ 'Cause the steaks were so high /
|
||||||
|
--------------------------------
|
||||||
|
\ ^__^
|
||||||
|
\ (xx)\_______
|
||||||
|
(__)\ )\/\
|
||||||
|
U ||----w |
|
||||||
|
|| ||
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
If you find a bug in Cowsay.jl, please [file an issue]. I will not be accepting
|
||||||
|
any requests for new cowfiles in this repo, though.
|
||||||
|
|
||||||
|
[file an issue]: https://github.com/MillironX/Cowsay.jl/issues
|
||||||
|
[julia repl]: https://docs.julialang.org/en/v1/manual/getting-started/
|
||||||
[pkg mode]: https://docs.julialang.org/en/v1/stdlib/Pkg/
|
[pkg mode]: https://docs.julialang.org/en/v1/stdlib/Pkg/
|
||||||
[the documentation]: https://millironx.com/Cowsay.jl/stable
|
[the documentation]: https://millironx.com/Cowsay.jl/stable
|
||||||
[unexported Cowfiles]: https://millironx.com/Cowsay.jl/stable/cows/
|
[unexported cowfiles]: https://millironx.com/Cowsay.jl/stable/cows/
|
||||||
|
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
# This file is machine-generated - editing it directly is not advised
|
|
||||||
|
|
||||||
[[ANSIColoredPrinters]]
|
|
||||||
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
|
|
||||||
uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[[Base64]]
|
|
||||||
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
|
||||||
|
|
||||||
[[Cowsay]]
|
|
||||||
path = "/home/tchristensen/src/cowsay"
|
|
||||||
uuid = "b6370f49-8ad1-4651-ad9e-3639b35da0e9"
|
|
||||||
version = "0.1.0"
|
|
||||||
|
|
||||||
[[Dates]]
|
|
||||||
deps = ["Printf"]
|
|
||||||
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
|
||||||
|
|
||||||
[[DocStringExtensions]]
|
|
||||||
deps = ["LibGit2"]
|
|
||||||
git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
|
|
||||||
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
|
|
||||||
version = "0.8.6"
|
|
||||||
|
|
||||||
[[Documenter]]
|
|
||||||
deps = ["ANSIColoredPrinters", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
|
|
||||||
git-tree-sha1 = "f425293f7e0acaf9144de6d731772de156676233"
|
|
||||||
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
|
||||||
version = "0.27.10"
|
|
||||||
|
|
||||||
[[IOCapture]]
|
|
||||||
deps = ["Logging", "Random"]
|
|
||||||
git-tree-sha1 = "f7be53659ab06ddc986428d3a9dcc95f6fa6705a"
|
|
||||||
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
|
|
||||||
version = "0.2.2"
|
|
||||||
|
|
||||||
[[InteractiveUtils]]
|
|
||||||
deps = ["Markdown"]
|
|
||||||
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
|
|
||||||
|
|
||||||
[[JSON]]
|
|
||||||
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
|
|
||||||
git-tree-sha1 = "8076680b162ada2a031f707ac7b4953e30667a37"
|
|
||||||
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
|
||||||
version = "0.21.2"
|
|
||||||
|
|
||||||
[[LibGit2]]
|
|
||||||
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
|
|
||||||
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
|
|
||||||
|
|
||||||
[[Logging]]
|
|
||||||
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
|
|
||||||
|
|
||||||
[[Markdown]]
|
|
||||||
deps = ["Base64"]
|
|
||||||
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
|
|
||||||
|
|
||||||
[[Mmap]]
|
|
||||||
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
|
|
||||||
|
|
||||||
[[NetworkOptions]]
|
|
||||||
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
|
|
||||||
|
|
||||||
[[Parsers]]
|
|
||||||
deps = ["Dates"]
|
|
||||||
git-tree-sha1 = "ae4bbcadb2906ccc085cf52ac286dc1377dceccc"
|
|
||||||
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
|
|
||||||
version = "2.1.2"
|
|
||||||
|
|
||||||
[[Printf]]
|
|
||||||
deps = ["Unicode"]
|
|
||||||
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
|
||||||
|
|
||||||
[[REPL]]
|
|
||||||
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
|
|
||||||
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
|
|
||||||
|
|
||||||
[[Random]]
|
|
||||||
deps = ["Serialization"]
|
|
||||||
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
|
||||||
|
|
||||||
[[SHA]]
|
|
||||||
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
|
|
||||||
|
|
||||||
[[Serialization]]
|
|
||||||
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
|
|
||||||
|
|
||||||
[[Sockets]]
|
|
||||||
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
|
|
||||||
|
|
||||||
[[Test]]
|
|
||||||
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
|
|
||||||
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
|
||||||
|
|
||||||
[[Unicode]]
|
|
||||||
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
[deps]
|
[deps]
|
||||||
Cowsay = "b6370f49-8ad1-4651-ad9e-3639b35da0e9"
|
Cowsay = "b6370f49-8ad1-4651-ad9e-3639b35da0e9"
|
||||||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
||||||
|
|
||||||
|
[compat]
|
||||||
|
Documenter = "1"
|
||||||
|
|
|
||||||
32
docs/make.jl
32
docs/make.jl
|
|
@ -3,24 +3,48 @@ using Documenter
|
||||||
|
|
||||||
DocMeta.setdocmeta!(Cowsay, :DocTestSetup, :(using Cowsay); recursive=true)
|
DocMeta.setdocmeta!(Cowsay, :DocTestSetup, :(using Cowsay); recursive=true)
|
||||||
|
|
||||||
|
struct GiteaRemote <: Documenter.Remote
|
||||||
|
host::String
|
||||||
|
user::String
|
||||||
|
repo::String
|
||||||
|
end
|
||||||
|
|
||||||
|
function Documenter.Remotes.repourl(remote::GiteaRemote)
|
||||||
|
return "https://$(remote.host)/$(remote.user)/$(remote.repo)"
|
||||||
|
end
|
||||||
|
|
||||||
|
function Documenter.Remotes.fileurl(remote::GiteaRemote, ref, filename, linerange)
|
||||||
|
if isnothing(linerange)
|
||||||
|
return "https://$(remote.host)/$(remote.user)/$(remote.repo)/src/commit/$ref/$filename"
|
||||||
|
else
|
||||||
|
return "https://$(remote.host)/$(remote.user)/$(remote.repo)/src/commit/$ref/$filename#L$(first(linerange))-$(last(linerange))"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Documenter.Remotes.issueurl(remote::GiteaRemote, issuenumber)
|
||||||
|
return "https://$(remote.host)/$(remote.user)/$(remote.repo)/issues/$issuenumber"
|
||||||
|
end
|
||||||
|
|
||||||
makedocs(;
|
makedocs(;
|
||||||
modules=[Cowsay],
|
modules=[Cowsay],
|
||||||
authors="Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> and contributors",
|
authors="Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> and contributors",
|
||||||
repo="https://github.com/MillironX/cowsay.jl/blob/{commit}{path}#{line}",
|
repo=GiteaRemote("code.millironx.com", "millironx", "Cowsay.jl"),
|
||||||
sitename="cowsay.jl",
|
sitename="Cowsay.jl",
|
||||||
format=Documenter.HTML(;
|
format=Documenter.HTML(;
|
||||||
prettyurls=get(ENV, "CI", "false") == "true",
|
prettyurls=get(ENV, "CI", "false") == "true",
|
||||||
canonical="https://millironx.com/Cowsay.jl",
|
canonical="https://cowsay-jl.millironx.com/",
|
||||||
assets=String[],
|
assets=String[],
|
||||||
),
|
),
|
||||||
pages=[
|
pages=[
|
||||||
"Home" => "index.md",
|
"Home" => "index.md",
|
||||||
"Available Cowfiles" => "cows.md",
|
"Available Cowfiles" => "cows.md",
|
||||||
"Make your own Cowfile" => "cowfiles.md",
|
"Make your own Cowfile" => "cowfiles.md",
|
||||||
|
"Private API Reference" => "private.md",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
deploydocs(;
|
deploydocs(;
|
||||||
repo="github.com/MillironX/Cowsay.jl",
|
repo="code.millironx.com/millironx/Cowsay.jl",
|
||||||
devbranch="master",
|
devbranch="master",
|
||||||
|
branch="pages",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
7
docs/src/private.md
Normal file
7
docs/src/private.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Private API Reference
|
||||||
|
|
||||||
|
Internal functions used by Cowsay.jl.
|
||||||
|
|
||||||
|
```@autodocs
|
||||||
|
Modules = [Cowsay]
|
||||||
|
```
|
||||||
175
src/Cowsay.jl
175
src/Cowsay.jl
|
|
@ -56,7 +56,18 @@ Print an ASCII picture of a cow saying/thinking `message`
|
||||||
cowfiles support this, though.
|
cowfiles support this, though.
|
||||||
- `tongue::AbstractString=" "`: A two-character string to be drawn in for the tongue. Not
|
- `tongue::AbstractString=" "`: A two-character string to be drawn in for the tongue. Not
|
||||||
all cowfiles support this.
|
all cowfiles support this.
|
||||||
- `wrap::Int`=40: The number of characters at which to wrap `message` to a new line
|
- `wrap::Int=40`: The number of characters at which to wrap `message` to a new line
|
||||||
|
- `nowrap::Bool=false`: Don't perform text wrapping on `message`
|
||||||
|
|
||||||
|
## Cow appearance Keywords
|
||||||
|
- `borg::Bool=false`: Initiates Borg mode
|
||||||
|
- `dead::Bool=false`: Causes the cow to appear dead
|
||||||
|
- `greedy::Bool=false`: Invokes greedy mode
|
||||||
|
- `paranoid::Bool=false`: Causes a state of paranoia to come over the cow
|
||||||
|
- `stoned::Bool=false`: Makes the cow appear thoroughly stoned
|
||||||
|
- `tired::Bool=false`: Yields a tired cow
|
||||||
|
- `wired::Bool=false`: Somewhat the opposite of `tired`, and initiates wired mode
|
||||||
|
- `young::Bool=false`: Brings on the cow's youthful appearance
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||
```jldoctest
|
```jldoctest
|
||||||
|
|
@ -81,12 +92,12 @@ julia> cowthink("Have I mooed today?")
|
||||||
|| ||
|
|| ||
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
function cowsay(message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
|
function cowsay(message::AbstractString; kwargs...)
|
||||||
cowsay(stdout, message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap)
|
cowsay(stdout, message; kwargs...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function cowsay(io::IO, message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
|
function cowsay(io::IO, message::AbstractString; kwargs...)
|
||||||
println(io, cowsaid(message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap))
|
println(io, cowsaid(message; kwargs...))
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
@ -96,12 +107,12 @@ Print an ASCII picture of a cow thinking `message`
|
||||||
|
|
||||||
See [`cowsay`](@ref)
|
See [`cowsay`](@ref)
|
||||||
"""
|
"""
|
||||||
function cowthink(message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
|
function cowthink(message::AbstractString; kwargs...)
|
||||||
cowthink(stdout, message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap)
|
cowthink(stdout, message; kwargs...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function cowthink(io::IO, message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
|
function cowthink(io::IO, message::AbstractString; kwargs...)
|
||||||
println(io, cowthunk(message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap))
|
println(io, cowthunk(message; kwargs...))
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
@ -123,9 +134,8 @@ julia> cowthunk("Have I mooed today?")
|
||||||
" _____________________\\n( Have I mooed today? )\\n ---------------------\\n o ^__^\\n o (oo)\\\\_______\\n (__)\\\\ )\\\\/\\\\\\n ||----w |\\n || ||\\n"
|
" _____________________\\n( Have I mooed today? )\\n ---------------------\\n o ^__^\\n o (oo)\\\\_______\\n (__)\\\\ )\\\\/\\\\\\n ||----w |\\n || ||\\n"
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
function cowsaid(message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
|
function cowsaid(message::AbstractString; kwargs...)
|
||||||
balloon = sayballoon(TextWrap.wrap(message, width=wrap))
|
return cowmoo(message, :say; kwargs...)
|
||||||
return string(balloon, cow(eyes=eyes, tongue=tongue))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
@ -135,9 +145,110 @@ Construct art of a cow thinking `message`.
|
||||||
|
|
||||||
See [`cowsaid`](@ref) and [`cowsay`](@ref)
|
See [`cowsaid`](@ref) and [`cowsay`](@ref)
|
||||||
"""
|
"""
|
||||||
function cowthunk(message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
|
function cowthunk(message::AbstractString; kwargs...)
|
||||||
balloon = thinkballoon(TextWrap.wrap(message, width=wrap))
|
return cowmoo(message, :think; kwargs...)
|
||||||
return string(balloon, cow(eyes=eyes, tongue=tongue, thoughts="o"))
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
cowmoo(message::AbstractString, mode, kwargs...)
|
||||||
|
|
||||||
|
Converts `message` into either saying or thinking art based on the value of `mode`. All of
|
||||||
|
the default values for `kwargs` for pretty much every other function live here. See
|
||||||
|
[`cowsay`](@ref) for their descriptions.
|
||||||
|
"""
|
||||||
|
function cowmoo(message::AbstractString, mode; kwargs...)
|
||||||
|
cow = dict_or_default(kwargs, :cow, Cowsay.default)
|
||||||
|
eyes = dict_or_default(kwargs, :eyes, "oo")
|
||||||
|
tongue = dict_or_default(kwargs, :tongue, " ")
|
||||||
|
wrap = dict_or_default(kwargs, :wrap, 40)
|
||||||
|
nowrap = dict_or_default(kwargs, :nowrap, false)
|
||||||
|
|
||||||
|
eyes, tongue = construct_face!(eyes, tongue; kwargs...)
|
||||||
|
|
||||||
|
# Default to 'say' mode
|
||||||
|
if mode == :think
|
||||||
|
balloon = thinkballoon
|
||||||
|
thoughts = "o"
|
||||||
|
else
|
||||||
|
balloon = sayballoon
|
||||||
|
thoughts = "\\"
|
||||||
|
end
|
||||||
|
|
||||||
|
wrapped_message = !nowrap ? TextWrap.wrap(message, width=wrap, replace_whitespace=false) : message
|
||||||
|
speechbubble = balloon(wrapped_message)
|
||||||
|
|
||||||
|
return string(speechbubble, cow(eyes=eyes, tongue=tongue, thoughts=thoughts))
|
||||||
|
end
|
||||||
|
|
||||||
|
function construct_face!(eyes, tongue; kwargs...)
|
||||||
|
borg = dict_or_default(kwargs, :borg, false)
|
||||||
|
dead = dict_or_default(kwargs, :dead, false)
|
||||||
|
greedy = dict_or_default(kwargs, :greedy, false)
|
||||||
|
paranoid = dict_or_default(kwargs, :paranoid, false)
|
||||||
|
stoned = dict_or_default(kwargs, :stoned, false)
|
||||||
|
tired = dict_or_default(kwargs, :tired, false)
|
||||||
|
wired = dict_or_default(kwargs, :wired, false)
|
||||||
|
young = dict_or_default(kwargs, :young, false)
|
||||||
|
|
||||||
|
if borg
|
||||||
|
eyes = "=="
|
||||||
|
end
|
||||||
|
|
||||||
|
if dead
|
||||||
|
eyes = "xx"
|
||||||
|
tongue = "U "
|
||||||
|
end
|
||||||
|
|
||||||
|
if greedy
|
||||||
|
eyes = "\$\$"
|
||||||
|
end
|
||||||
|
|
||||||
|
if paranoid
|
||||||
|
eyes = "@@"
|
||||||
|
end
|
||||||
|
|
||||||
|
if stoned
|
||||||
|
eyes = "**"
|
||||||
|
tongue = "U "
|
||||||
|
end
|
||||||
|
|
||||||
|
if tired
|
||||||
|
eyes = "--"
|
||||||
|
end
|
||||||
|
|
||||||
|
if wired
|
||||||
|
eyes = "OO"
|
||||||
|
end
|
||||||
|
|
||||||
|
if young
|
||||||
|
eyes = ".."
|
||||||
|
end
|
||||||
|
|
||||||
|
return eyes, tongue
|
||||||
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
dict_or_default(dict, key, value)
|
||||||
|
|
||||||
|
If `key` is present in `dict`, then return `dict[key]`, otherwise return `value`
|
||||||
|
|
||||||
|
# Example
|
||||||
|
```jldoctest
|
||||||
|
julia> dict = Dict(:holstein => "lotsa milk", :jersey => "butterfat", :shorthorn => "worthless");
|
||||||
|
|
||||||
|
julia> Cowsay.dict_or_default(dict, :holstein, "fluid")
|
||||||
|
"lotsa milk"
|
||||||
|
|
||||||
|
julia> Cowsay.dict_or_default(dict, :brown_swiss, "cheese")
|
||||||
|
"cheese"
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
function dict_or_default(dict, key, value)
|
||||||
|
if haskey(dict, key)
|
||||||
|
return dict[key]
|
||||||
|
else
|
||||||
|
return value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
@ -173,7 +284,7 @@ function sayballoon(message::AbstractString)
|
||||||
" \\\n"
|
" \\\n"
|
||||||
)
|
)
|
||||||
if nlines > 2
|
if nlines > 2
|
||||||
for i=2:nlines-1
|
for i = 2:nlines-1
|
||||||
balloon = string(
|
balloon = string(
|
||||||
balloon,
|
balloon,
|
||||||
"| ",
|
"| ",
|
||||||
|
|
@ -210,25 +321,25 @@ function thinkballoon(message::AbstractString)
|
||||||
linelength = max(length.(messagelines)...)
|
linelength = max(length.(messagelines)...)
|
||||||
paddinglength = linelength + 2
|
paddinglength = linelength + 2
|
||||||
|
|
||||||
balloon = string(
|
balloon = string(
|
||||||
" ",
|
" ",
|
||||||
repeat("_", paddinglength),
|
repeat("_", paddinglength),
|
||||||
"\n"
|
"\n"
|
||||||
)
|
)
|
||||||
for i in 1:nlines
|
for i in 1:nlines
|
||||||
balloon = string(
|
|
||||||
balloon,
|
|
||||||
"( ",
|
|
||||||
rpad(messagelines[i], linelength),
|
|
||||||
" )\n"
|
|
||||||
)
|
|
||||||
end #for
|
|
||||||
balloon = string(
|
balloon = string(
|
||||||
balloon,
|
balloon,
|
||||||
" ",
|
"( ",
|
||||||
repeat("-", paddinglength),
|
rpad(messagelines[i], linelength),
|
||||||
"\n"
|
" )\n"
|
||||||
)
|
)
|
||||||
|
end #for
|
||||||
|
balloon = string(
|
||||||
|
balloon,
|
||||||
|
" ",
|
||||||
|
repeat("-", paddinglength),
|
||||||
|
"\n"
|
||||||
|
)
|
||||||
|
|
||||||
return balloon
|
return balloon
|
||||||
end #function
|
end #function
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,28 @@ DocMeta.setdocmeta!(Cowsay, :DocTestSetup, :(using Cowsay); recursive=true)
|
||||||
# Cowthink with io redirection
|
# Cowthink with io redirection
|
||||||
@test_warn cowthunk("Moo") cowthink(stderr, "Moo")
|
@test_warn cowthunk("Moo") cowthink(stderr, "Moo")
|
||||||
end
|
end
|
||||||
|
@testset "Word Wrapping" begin
|
||||||
|
# Long text, default wrap
|
||||||
|
@test cowsaid("Rollin' down a long highway out through New Mexico driftin' down to Santa Fe to ride a bull in a rodeo") == " _________________________________________\n/ Rollin' down a long highway out through \\\n| New Mexico driftin' down to Santa Fe to |\n\\ ride a bull in a rodeo /\n -----------------------------------------\n \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||\n"
|
||||||
|
|
||||||
|
# Long text, no wrap
|
||||||
|
@test cowsaid("Rollin' down a long highway out through New Mexico driftin' down to Santa Fe to ride a bull in a rodeo", nowrap=true) == " ________________________________________________________________________________________________________\n< Rollin' down a long highway out through New Mexico driftin' down to Santa Fe to ride a bull in a rodeo >\n --------------------------------------------------------------------------------------------------------\n \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||\n"
|
||||||
|
|
||||||
|
# Long text, conflicting wrap instructions (nowrap should win)
|
||||||
|
@test cowsaid("Rollin' down a long highway out through New Mexico driftin' down to Santa Fe to ride a bull in a rodeo", wrap=80, nowrap=true) == " ________________________________________________________________________________________________________\n< Rollin' down a long highway out through New Mexico driftin' down to Santa Fe to ride a bull in a rodeo >\n --------------------------------------------------------------------------------------------------------\n \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||\n"
|
||||||
|
|
||||||
|
# Long text, different wrap amount
|
||||||
|
@test cowsaid("Rollin' down a long highway out through New Mexico driftin' down to Santa Fe to ride a bull in a rodeo", wrap=80) == " _________________________________________________________________________________\n/ Rollin' down a long highway out through New Mexico driftin' down to Santa Fe to \\\n\\ ride a bull in a rodeo /\n ---------------------------------------------------------------------------------\n \\ ^__^\n \\ (oo)\\_______\n (__)\\ )\\/\\\n ||----w |\n || ||\n"
|
||||||
|
end
|
||||||
|
@testset "Cow Modes" begin
|
||||||
|
@test Cowsay.construct_face!("oo", " ") == ("oo", " ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; borg=true) == ("==", " ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; dead=true) == ("xx", "U ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; greedy=true) == ("\$\$", " ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; paranoid=true) == ("@@", " ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; stoned=true) == ("**", "U ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; tired=true) == ("--", " ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; wired=true) == ("OO", " ")
|
||||||
|
@test Cowsay.construct_face!("oo", " "; young=true) == ("..", " ")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue