Add text-wrapping to all functions

This commit is contained in:
Thomas A. Christensen II 2022-02-01 17:01:14 -06:00
parent 4a7b954f50
commit fb3fae2663
Signed by: millironx
GPG key ID: 139C07724802BC5D

View file

@ -56,6 +56,7 @@ 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
# Example # Example
```jldoctest ```jldoctest
@ -80,12 +81,12 @@ julia> cowthink("Have I mooed today?")
|| || || ||
``` ```
""" """
function cowsay(message::AbstractString; cow=default, eyes="oo", tongue=" ") function cowsay(message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
cowsay(stdout, message, cow=cow, eyes=eyes, tongue=tongue) cowsay(stdout, message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap)
end end
function cowsay(io::IO, message::AbstractString; cow=default, eyes="oo", tongue=" ") function cowsay(io::IO, message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
println(io, cowsaid(message, cow=cow, eyes=eyes, tongue=tongue)) println(io, cowsaid(message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap))
end end
""" """
@ -95,12 +96,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=" ") function cowthink(message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
cowthink(stdout, message, cow=cow, eyes=eyes, tongue=tongue) cowthink(stdout, message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap)
end end
function cowthink(io::IO, message::AbstractString; cow=default, eyes="oo", tongue=" ") function cowthink(io::IO, message::AbstractString; cow=default, eyes="oo", tongue=" ", wrap=40)
println(io, cowthunk(message, cow=cow, eyes=eyes, tongue=tongue)) println(io, cowthunk(message, cow=cow, eyes=eyes, tongue=tongue, wrap=wrap))
end end
""" """