ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <Blacksmoke16> is there a built in way to print a string with a max length of n?
<FromGitter> <tenebrousedge> how do you mean?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=608214a2dc24646812da8123]
<FromGitter> <Blacksmoke16> assuming the width is 15
<FromGitter> <Blacksmoke16> looked like https://crystal-lang.org/api/master/PrettyPrint.html#format(obj,io:IO,width:Int32,newline=%22%5Cn%22,indent=0)-class-method could do it but doesnt seem to do the breaking, or at least doesnt consider the string breakable
<FromGitter> <tenebrousedge> I can't interpret the docs there
<FromGitter> <Blacksmoke16> guess ill just do it myself then
<FromGitter> <Blacksmoke16> open to better ideas tho :P
<FromGitter> <tenebrousedge> I mean you could get most of the way there with `gsub` but it would be nasty to read
<FromGitter> <tenebrousedge> oh um `each_cons`
<FromGitter> <Blacksmoke16> its also unfortunate colorize uses `0` code to end its sequences
<FromGitter> <Blacksmoke16> ```foo = "foo".colorize.red ⏎ ⏎ str = "hello #{foo} bar".colorize.underline ⏎ ⏎ puts str``` [https://gitter.im/crystal-lang/crystal?at=60821981b6a4714a29dfaaa6]
<FromGitter> <Blacksmoke16> `hello ` is underlined and white, `foo` is underlined and red, ` bar` is white but no underline because `0` code clears all versus just the red color :/
<FromGitter> <tenebrousedge> huh
<FromGitter> <Blacksmoke16> prob is a bug, imma try and fix it
<FromGitter> <tenebrousedge> that's really more than I want to know about ANSI escape codes
<FromGitter> <Blacksmoke16> more than I knew earlier today too ha
<FromGitter> <Blacksmoke16> porting some PHP code and noticed the formatted string's were diff
<FromGitter> <Blacksmoke16> eh, i think ill just file it as a bug :p
<Andriamanitra> in ruby you could do something like "puts str.scan(.{1,#{width}})", i couldn't figure out a way to make it as nice (nasty) in crystal though
<Andriamanitra> i guess "puts str.chars.each_slice(width).map(&.join).join('\n')" is pretty much as good as it gets
<FromGitter> <Blacksmoke16> `str.scan /.{1, #{width}}/`?
<Andriamanitra> yeah forgot the // :p
<FromGitter> <Blacksmoke16> oh for the line wrapping
<FromGitter> <tenebrousedge> `gsub(/.{1, #{width}}/, "# \\0 \n")`
<FromGitter> <tenebrousedge> or something like that
<FromGitter> <Blacksmoke16> i just copied the PHP implementation for now, as it does other things too
<FromGitter> <Blacksmoke16> i/someone else can revisit it later :P
<FromGitter> <Blacksmoke16> ```output.puts "pre <error>Bad thing!</error> post"```
<FromGitter> <Blacksmoke16> can define styles for tags for use in output
duane has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
_ht has joined #crystal-lang
ua_ has quit [Read error: Connection reset by peer]
ua_ has joined #crystal-lang
<FromGitter> <shootingfly> Hi, everyone. My clients are facing unfortunately an issue with the docker (When I upgrade the crystal version to 1.0.0). execute error: server error Hostname lookup for myscale.api.svc.cluster.local failed: System error
<FromGitter> <shootingfly> Is there anyone who can help me? My customer upgraded a program to crystal 1.0.0 with .local domain. We use docker, crystal 1.0.0-alpine with `crystal build src/main.cr --release --static`.
<FromGitter> <erdnaxeli:cervoi.se> that looks like a network error
<FromGitter> <shootingfly> He rollbacked and retried many times between v0.35.1 and v1.0.0 ⏎ And for sure no issue with previous version v0.35.1 :/
<FromGitter> <shootingfly> I have tested without .local domain in my machine. It is succeed.
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #crystal-lang
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 240 seconds]
<FromGitter> <erdnaxeli:cervoi.se> he could try with crystal 1.0 not in an docker
<FromGitter> <erdnaxeli:cervoi.se> to known if it comes from crystal 1.0 or from the alpine version that changed
<FromGitter> <shootingfly> > to known if it comes from crystal 1.0 or from the alpine version that changed ⏎ ⏎ He is a java programmer and knows nothing about Crystal. I released a docker to him and he used it. But I have no .local domain.
<jhass> shootingfly: is not -alpine an option to try? There's historically been some issues around alpine's libc and local/mdns resolution
<jhass> I could imagine it's less about Crystal 1.0 and more a change in alpine version
postmodern has quit [Quit: Leaving]
<straight-shoota> yeah, that's very unlikely to be a Crystal issue
<straight-shoota> to verify, you can try an older alpine base image with Crystal 1.0. It won't be available in APK but you can just grab the generic linux tarball from Github.
mipmip has quit [Read error: Connection reset by peer]
mipmip has joined #crystal-lang
<FromGitter> <shootingfly> It is solved! Because I compiled it in general crystal, not alpine, and then run it in alpine.
<FromGitter> <erdnaxeli:cervoi.se> oh, right