RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <aisrael> @valamorgon I don’t think Crystal supports true run-time dynamic evaluation. It doesn’t even have reflection AFAIK. ⏎ ⏎ Most you can maybe do is a hash of `String` to block/prod to call.
<FromGitter> <aisrael> (I hate the Gitter app)
sz0 has quit [Quit: Connection closed for inactivity]
wontruefree has quit [Ping timeout: 264 seconds]
DTZUZO has quit [Ping timeout: 268 seconds]
<FromGitter> <sam0x17> is there a rubocop/eslint-style linter for crystal?
<FromGitter> <sam0x17> (i'm expecting a no)
<FromGitter> <sam0x17> @valamorgon the closest you can get to that is using `method_missing` at compile time
<FromGitter> <aisrael> I just go `crystal tool format`. But that’s just styling. Not semantic as far as I can tell
<FromGitter> <sam0x17> if you need to do dynamic class/method referencing at runtime you could always manage your own data structure e.g. a hash of String to classes/procs/etc like aisrael said
<FromGitter> <sam0x17> @aisrael gotcha
<FromGitter> <bew> @aisrael what do you mean "not semantic"? what do you want?
<FromGitter> <aisrael> Am specifically looking at more advanced PMD/Findbugs (Java) or flog/flay in Ruby. Stuff like complexity metrics, Demeter violations, etc.
<FromGitter> <aisrael> So, by “semantic” I meant beyond just analyzing the styling or syntax, but actual code semantics for potential code smells or violations.
zachk has quit [Quit: Leaving]
<FromGitter> <aisrael> I realize the compiler already performs a bunch of checks (like `nil` checking). Not sure if the compiler flags unused variables (unnecessary object creation). Pretty sure it doesn’t flag unused `require`s (like Go)
<FromGitter> <bew> you might want to checkout https://github.com/veelenga/ameba
<FromGitter> <bew> it's not as complete as you describe, but it does some things
<crystal-gh> [crystal] asterite opened pull request #6320: Fix: disallow cast from module class to virtual metaclass (master...bug/6113-cast-from-module-class-to-virtual-metaclass) https://git.io/fSGnx
<FromGitter> <aisrael> Thanks, will do!
<FromGitter> <aisrael> Hey, `ameba` fits the bill! Will try to see if I can contribute any additional checks.
alex`` has quit [Ping timeout: 240 seconds]
<FromGitter> <bararchy> @aisrael ameba is great, we use it also in the SDLC process. Also, checkout Scry
<FromGitter> <bararchy> wow I just can't seem to be able to use the JSON::Sereliazble module, invalid mem access all over the place lol
<FromGitter> <tbrand> Hi forks! Let me ask a question. Is there any way to hook object finalization? I would like to call a method just before the finalization.
<FromGitter> <tbrand> I mean just before the GC destroys the object.
<FromGitter> <bararchy> `def finalize`
<FromGitter> <tbrand> I tries this
<FromGitter> <tbrand> Oh just inherit it? cool. will try. thanks.
<FromGitter> <bew> Huh? @tbrand just add a `finalize` method in your class, and do what you have to do there
<FromGitter> <tbrand> @bew @bararchy Cool. Thanks! 👍
<FromGitter> <bew> @bararchy 👍
<FromGitter> <bararchy> np :)
<FromGitter> <bararchy> @tbrand cooking something interesting for SushiChain? ;)
<FromGitter> <tbrand> Not related to it. :)
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <Grabli66> Hi! Why? https://play.crystal-lang.org/#/r/4fz9
<FromGitter> <reiswindy> Don't forget to `require "http"`
rohitpaulk has joined #crystal-lang
<FromGitter> <Grabli66> Great :)
<FromGitter> <mtn> New to crystal and trying things out. I'm reading in a character from stdin with: `ch = STDIN.raw &.read_char`
<FromGitter> <mtn> How can I interpret it as an integer?
<FromGitter> <Grabli66> to_i
<FromGitter> <mtn> I end up with an error because of the possibility of `nil` though. Is there some sort of pattern matching of `if-else` I should be doing?
<FromGitter> <Grabli66> Or like this https://play.crystal-lang.org/#/r/4g01
<FromGitter> <mtn> 👍 thanks!
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
pbodev1 has joined #crystal-lang
DTZUZO has joined #crystal-lang
alex`` has joined #crystal-lang
<crystal-gh> [crystal] sdogruyol closed pull request #6320: Fix: disallow cast from module class to virtual metaclass (master...bug/6113-cast-from-module-class-to-virtual-metaclass) https://git.io/fSGnx
<crystal-gh> crystal/master fafdd63 Ary Borenszweig: Remove File.each_line method that returns an iterator (#6301)
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/fSG0u
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
<travis-ci> crystal-lang/crystal#48530e5 (master - Fix: disallow cast from module class to virtual metaclass (#6320)): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/399443715
<DeBot> https://github.com/crystal-lang/crystal/pull/6320 (Fix: disallow cast from module class to virtual metaclass)
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
flaviodesousa has joined #crystal-lang
<travis-ci> crystal-lang/crystal#fafdd63 (master - Remove File.each_line method that returns an iterator (#6301)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/399444004
<DeBot> https://github.com/crystal-lang/crystal/pull/6301 (Remove File.each_line method that returns an iterator)
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<travis-ci> crystal-lang/crystal#48530e5 (master - Fix: disallow cast from module class to virtual metaclass (#6320)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/399443715
<DeBot> https://github.com/crystal-lang/crystal/pull/6320 (Fix: disallow cast from module class to virtual metaclass)
DeBot has quit [Quit: Crystal IRC]
asterite has quit [Quit: Bye]
jhass has quit [Quit: Bye]
DeBot has joined #crystal-lang
asterite has joined #crystal-lang
jhass has joined #crystal-lang
<FromGitter> <j8r> @drujensen If you have a Raspberry PI 3 you can use https://www.armbian.com/ arm64 . To cross compile, you can use qemu as https://github.com/n00ax/crystal-crosscompile-tool or https://github.com/DFabric/apps-static/tree/master/source/dppm-static
alex`` has quit [Quit: WeeChat 2.1]
tilpner has quit [Ping timeout: 264 seconds]
tilpner has joined #crystal-lang
<FromGitter> <Grabli66> Can i compile app, written in crystal for OpenWRT ? :)
<FromGitter> <j8r> this is Linux, so yes
<FromGitter> <j8r> Depends on the underlying architecture of the machine
<FromGitter> <Grabli66> I think about MIPS
<RX14> no then
<FromGitter> <Grabli66> It's impossible?
<FromGitter> <j8r> you could use qemu to run a binary of another architecture on MIPS, but you'll get horrible perfs
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
_whitelogger has joined #crystal-lang
tilpner has quit [Ping timeout: 256 seconds]
<oprypin> Python just accepted an assignment expression https://www.python.org/dev/peps/pep-0572/#syntax-and-semantics
<oprypin> it is very explicit and *parentheses are mandatory*
<oprypin> i have said before this that I would like parenthese to be mandatory in Crystal
<RX14> I'd be fine with it
<RX14> well
<RX14> to a point
<RX14> obviously not between operators of the same precedence
<FromGitter> <yxhuvud> I would totally hate a specific assignment operator for if statements though
<FromGitter> <yxhuvud> I can sortof see why they want it as it also apply to list comprehensions, but that is just fallout from not having blocks.
alex`` has joined #crystal-lang
DTZUZO has quit [Ping timeout: 256 seconds]
<FromGitter> <mamantoha> @watzon https://watzon.me/projects/json-to-crystal is unavailable
<FromGitter> <bararchy> it's a really cool project :)
<FromGitter> <rishavs> Has anyone used crystal with xunit/mstest/vstest? I am trying to use the ci/cd on vsts for my crystal project
<FromGitter> <j8r> How can I wait for an event from the keyboard an return it? Basically a `gets` without to have to press enter
<FromGitter> <bendietze_twitter> @j8r i think this should depend on the context in which you want to get this, because the OS manages this. It's a difference, if you are in bash, in a browser textfield and so on, so, i think generally it's a more specific question to the environment - the place where the keyboard would be listened / actually bounded to by OS - correct me if i am wrong :)
tilpner has joined #crystal-lang
<crystal-gh> [crystal] RX14 closed pull request #6317: Flatten project structure created by crystal init (master...jm/feature/crystal-init-remove-version.cr) https://git.io/fSs7A
<RX14> i'm glad everyone agreed on that PR
<FromGitter> <j8r> This is in terminal. `STDIN.gets` works, but I'm searching a way to only get one char and return it, and loop again
<FromGitter> <bararchy> RX14 which PR?
<FromGitter> <j8r> I guess #6317
<DeBot> https://github.com/crystal-lang/crystal/pull/6317 (Flatten project structure created by crystal init)
<RX14> the one the bot just came in IRC and told everyone was merged :)
<FromGitter> <bararchy> @j8r ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b3b66be9b82c6701b9e8136]
<FromGitter> <bararchy> Oh, I like version.cr XD
<FromGitter> <bararchy> always keep it updated and in shard.yml
<RX14> version.cr isn't gone
<RX14> well
<RX14> the constant isnt gone
<RX14> its just moved
<FromGitter> <yxhuvud> I would have preferred it in a separate file, but perhaps on the top level in /src/, but it is not as if it matter too much
<FromGitter> <yxhuvud> and to be honest I'd also prefer to have shards.yml list all files that is require-able, explicitly.
<FromGitter> <j8r> @bararchy nop, still need to press `enter` :|
<FromGitter> <bararchy> ahhhhh
<FromGitter> <bararchy> this souldn't happen
<FromGitter> <bararchy> RX14, any idea?
<FromGitter> <j8r> For the moment I'm using Termbox, `TermboxBindings.tb_poll_event pointerof(ev)`
<FromGitter> <bararchy> maybe sync option for the IO?
<RX14> no
<RX14> you need raw input
<RX14> STDIN.raw
<RX14> you need to instruct the terminal emulator not to buffer input
<RX14> when you press a key in your terminal it doesnt get sent to the application
<RX14> thats not how it works
<RX14> thats why you can edit lines before you press enter
<RX14> because the terminal emulator implements that
<RX14> so no need for weird STDIN.read stuff
<RX14> just STDIN.raw &.read_char
<FromGitter> <yxhuvud> why is stdin buffered? Isn't it normal to use readline or whatever if being able to edit the text is wanted?
<FromGitter> <j8r> yeah thanks @RX14 :D
<RX14> @yxhuvud no
<RX14> readline is for even more advanced stuff
<RX14> like going backwards in your text
<FromGitter> <yxhuvud> how do you edit text without going backwards ?!?!
<RX14> type `cat -` in your terminal and see what you can do
<RX14> readline lets you move around with arrow keys and use emacs-like or vim-like input etc.
<RX14> but nothing else
<RX14> you can use backspace
<RX14> by pressing backspace
<RX14> and typing it again
<RX14> if the text was immediately sent to the application you couldn't backspace at all
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/fHlGI
<crystal-gh> crystal/master 75b46ac Icyleaf Wang: add .new and .empty? to HTTP::Params (#6241)
<crystal-gh> [crystal] RX14 closed pull request #6241: add .new and .empty? to HTTP::Params (master...feature-http-params) https://git.io/f4Kxx
<travis-ci> crystal-lang/crystal#ae32184 (master - Flatten project structure created by crystal init (#6317)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/399546716
<DeBot> https://github.com/crystal-lang/crystal/pull/6317 (Flatten project structure created by crystal init)
<FromGitter> <bendietze_twitter> Its simply a question of how would you build an editor - a terminal is simply a kind of an editor/window over a scripting language like a bash or whatever - what API would you implement for comfort and low-level if you write such an keyboard-lasty environment? So, you can have raw, key, line,.. and choose between the possible (comfort) functions of this interface - so you would end up with the enter
<FromGitter> ... key as the last thing that could be done ;) Everything before is the way the terminal pipes it to fd 0, 1 and 2 and Crystal is reading from (or writing to)
<FromGitter> <MrSorcus> https://play.crystal-lang.org/#/r/4g3c ⏎ Doesn't work. But worked with 0.24.2 :-/
DTZUZO has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #6322: JSON/YAML: error if a maximum nesting is reached (prevents stack overflow) (master...feature/json-yaml-max-nesting) https://git.io/fHVe3
<FromGitter> <rishavs> how is a db connection generally passed in an app? ⏎ For example, I initialize my app as; ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5b3b70ee7e23133ecb2dc983]
<FromGitter> <MrSorcus> > *<z64>* @MrSorcus https://play.crystal-lang.org/#/r/4g3d ⏎ ⏎ Mmm... Thanks.
<z64> np
<travis-ci> crystal-lang/crystal#75b46ac (master - add .new and .empty? to HTTP::Params (#6241)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/399559103
<DeBot> https://github.com/crystal-lang/crystal/pull/6241 (add .new and .empty? to HTTP::Params)
<FromGitter> <bendietze_twitter> @rishavs sorry, can't follow the context, but be aware of saving raw passwords in your DB :) maybe, it's just for showing your error, so don't understand me wrong to implement this before it goes public in an blog or website ;)
snsei has quit [Ping timeout: 245 seconds]
snsei has joined #crystal-lang
<FromGitter> <bendietze_twitter> If it's just for your tutorial IMO it might be ok if you simply use a fake method like xyz.encrypt_pw() and let the readers implement their own or you tutorial it later :)
<FromGitter> <j8r> How can I create an UTF-8 Char from a Slice?
<FromGitter> <bendietze_twitter> Not #to_a? Or #to_s?
<FromGitter> <bendietze_twitter> Sorry, wrong copy to_a :)
<FromGitter> <rishavs> @bendietze_twitter Yep its for my tutorial and I am indeed using bcrypt for the hashing. :D ⏎ I really want to use working functions as I myself am building the app as I am writing the tutorial
<z64> @rishavs typically i have my own `class App::Database` that has `@db : DB::Database`, with instance methods that abstract the queries my application makes
duane has quit [Ping timeout: 264 seconds]
<FromGitter> <bendietze_twitter> @rishavs yes, i can remember you are very fast in doing this and would avoid you forget it and publish without :) 👍
<FromGitter> <rishavs> @z64 can you share some example code.
<z64> @rishavs sure. not the best example as this was never fully finished, but should give you the general idea: https://github.com/z64/discord-marketing-connector/blob/master/src/app/database.cr
<FromGitter> <rishavs> thank you 😄
<z64> here i make the connection when i instantiate that class, but you could just as well accept `def initialize(@db : DB::Database)`
<z64> maybe ignore `Query` lol. was just an idea i wanted to try
<FromGitter> <rishavs> I quite like your way of doing this. Super simple and looks quite elegant 👍
<z64> actually rishavs, in 0.25 you can now do this nice thing with heredocs: https://hastebin.com/relenemado.cr
<z64> i would have done that if it was available
<FromGitter> <rishavs> Yep. I actually used heredocs to create a simple view system (instead of templates/ecr)
<z64> cool:)
<FromGitter> <bendietze_twitter> @z64 is your last example with '<<-SQL, email)...' correct heredoc? Crazy, do not understand and didn't know
<FromGitter> <bendietze_twitter> (i do not understand that it starts as first argument and is defined and closed after)
<z64> @bendietze_twitter yes :) https://carc.in/#/r/4g43
<FromGitter> <asterite> @rishavs you should store a DB in a constant, and use that constant throughout the app
duane has joined #crystal-lang
<FromGitter> <bendietze_twitter> @z64 this is crazy - didnt got the logic behind, maybe i have to read this some days 😄
<FromGitter> <bendietze_twitter> Cool - i must check this, heredoc is such a powerful thing, crazy 😄 👍 thx
wontruefree has joined #crystal-lang
<wontruefree> has anyone here tried deploying crystal with a unikernel?
<FromGitter> <giuseongit> hi, is possible to call crystal function(s) from c code?
sz0 has joined #crystal-lang
<wontruefree> after looking through the doc i dont see a way but I have not built a c binding in crystal yet
<wontruefree> crystal does generate object files so I dont know if you can link into those
wontruefree has quit [Quit: bye]
<FromGitter> <giuseongit> I'd like to write a kernel module in crystal, but the only way to do it is write a thin wrapper in c that acts as an entry point for my crystal code
akaiiro has quit [Ping timeout: 248 seconds]
<FromGitter> <bendietze_twitter> BTW as a newbie i am scrolling every day a hundred times through the API looking for a method - search isn't helpful because i often have no more idea of naming something in english/Crystal-way and sometimes it feels my brain is formatted, so, the method overview is a good thing, but its so many scrolling too, IMO for newbies and many others it could be helpful to reduce it to a table overview -
<FromGitter> ... mostly a one-screener - of simply all #methods(params), for me this were nice if we implement this some days 😄 If there were some thoughts about i would give my 👍
<FromGitter> <j8r> @bendietze_twitter you can also use devdocs.io
<FromGitter> <fridgerator> I was going to mention that, it looks like it hasn't been updated to version 0.25 yet
wontruefree has joined #crystal-lang
<FromGitter> <bendietze_twitter> @j8r yes, thanks, i have used some times, might be worth to test it again :)
<FromGitter> <bendietze_twitter> @giuseongit i would be interested to know if a kernel module should be written in Crystal because nearly everything is written in C, so there would be wrappers around nearly everything? :) Makes it sense? @others?
<FromGitter> <giuseongit> @bendietze_twitter I found this (https://github.com/souvik1997/kernel-roulette) on github , but it's written in rust, i was just wondering if something similar could be done in crystal
<FromGitter> <bendietze_twitter> @giuseongit play Russian Roulette with the Linux kernel 😆 now you now why they choose Rust 😄
<FromGitter> <bendietze_twitter> Just a joke :) i will have a look, thx 👍
wontruefree has quit [Quit: bye]
<FromGitter> <bendietze_twitter> I think, the difference between Rust and Crystal is, that Rust is going every day to become the new (really dirty) low-level lang and Crystal is more the way to write quickly (but beautiful) native code, fast and clean - there would every day be new things in Rust which are not our way - but its just my opinion and a kernel module may already be possible :) Stay here while WIP :)
<FromGitter> <giuseongit> @bendietze_twitter but I still need some c code or it is possible to fully write it in crystal?
<FromGitter> <bendietze_twitter> All ..nixes are written mostly in C, so, bisides assembler this is their native language and i think you need many c-bindings and wrappers but i am not deep enough with capabilities of llvm - there are many people here in the chat which can help you lot more than i can :)
<FromGitter> <j8r> When using Rust you don't need C at all: https://github.com/redox-os/kernel
<FromGitter> <j8r> even on the libc side https://github.com/redox-os/relibc
<FromGitter> <j8r> The only C files are on the `/tests` folder
<FromGitter> <giuseongit> @j8r but it's a kernel, not a kernel module. I've also found a kernel (https://github.com/TheKernelCorp/Fluorite) written (almost) entirely in crystal
wontruefree has joined #crystal-lang
akaiiro has joined #crystal-lang
<FromGitter> <Willamin> I know about `crystal tool expand`, but is there any interest in a feature that does the macro pass over an entire project, outputting crystal code with all macros expanded?
greengriminal has joined #crystal-lang
<FromGitter> <rishavs> What does db.exec returns in case of any error? nil or an exception?
<FromGitter> <asterite> you can try it :-P
<FromGitter> <rishavs> it was a trap. Just wanted to bait someone knowledgeable for my real question :p ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ How do i specify my table name here as a variable? [https://gitter.im/crystal-lang/crystal?at=5b3b9ff1e534eb69a5c4b1c9]
<FromGitter> <rishavs> Actually I got it. This weird chimera version works; `unq_count = (Cove::DB.scalar "select count(*) from #{dbtable} where username = $1", itemval).as(Int)`
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
akaiiro has quit [Ping timeout: 256 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
akaiiro has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
<FromGitter> <shreeve> I'd like to pipe ansi-colorized output to a process that: 1) strips the colors and logs content to a file; and 2) passes the original stream from stdin to stdout
<FromGitter> <shreeve> Thinking of just using a pipe, but wondering how I handle output that is buffered so that escape sequences might be split across buffer reads
wontruefree has quit [Quit: bye]
<FromGitter> <shreeve> something like the 'tee' command line, but instead of writing the entire stream to a file, it would only write the de-colorized stream to the file and pass the colorized stream along
<FromGitter> <bew> it'd be better done by 2 program: one to remove ansi escape code and one to write to file, you already have the 2nd one (`tee`), you ust have to find the 1st one (or make it yourself)
<FromGitter> <shreeve> problem is that if I have program 1 strip the colors, then by the time the data gets to program 2, there are no colors
<FromGitter> <shreeve> so, i sort of need 1 program to do both things... strip the colors for what it's going to log, but pass the original colors along to stdout
<FromGitter> <bew> yes that's the idea, no?
<FromGitter> <bew> ah
<FromGitter> <shreeve> i wanted the colors to show on stdout (so they look 'purdy), but have just the content written to the file (so I can review it and read it in an editor)
<FromGitter> <bew> instead of doing the 2 in one operation, I think it's simpler to separate the task in the program: print to a file, and print to stdout. the subtle difference is that it doesn't only do stdout from your program, but do both operation separately in the program. It means that instead of removing ansi sequences, you can simply not send them to the file, and send them to stdout
<oprypin> bew, it's really not simpler
<oprypin> shreeve, `some_command | tee >(sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' >some_file)` anyway
<FromGitter> <shreeve> thank you both, i'll experiment with the above
<FromGitter> <shreeve> :-)
<FromGitter> <shreeve> worked great!
<FromGitter> <shreeve> `bam | tee >(sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' >bam.log)`
<FromGitter> <shreeve> (program was 'bam' and 'bam.log' was the logfile)
wontruefree has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Does Shards support Git Remote Helpers?
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <Daniel-Worrall> I don't think it does, but I would like a confirmation
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
Groogy has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
greengriminal has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Oh. Maybe it does now
<FromGitter> <Daniel-Worrall> It didn't work in 0.25.0, but does in 0.25.1
<FromGitter> <Daniel-Worrall> Not sure which Crystal version I was on
<FromGitter> <Daniel-Worrall> *Shards
<FromGitter> <valamorgon> is there any simple way to make reverse for loop?
<FromGitter> <shreeve> @bew @oprypin - fwiw, one more small (but important!) tweak to that pipeline was to make `sed` use output line buffering (otherwise, you can't see the output until the buffer fills up)... here's the final line:
<FromGitter> <shreeve> `bam | tee >(sed -l $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' >bam.log)`
<FromGitter> <shreeve> that little "-l" param to `sed` is key... with this, now I can just look at `bam.log` in sublime happily (without all the ANSI characters), but still see all the 'purdy colors on my console... thanks again for both of your help!!!
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
zachk has joined #crystal-lang
zachk has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] straight-shoota opened pull request #6323: Refactor and improve URI implementation (master...jm/fix/uri-refactor) https://git.io/f5bF1
<wontruefree> I have a reasonably fresh install of macosx and crystal is failing to build
<wontruefree> the linker is failing
<FromGitter> <fridgerator> wontruefree did you install these? https://github.com/crystal-lang/crystal/wiki/All-required-libraries#mac-osx-with-homebrew
<wontruefree> I did
<wontruefree> the xcode-select part might be out of date
<wontruefree> but yes
<FromGitter> <straight-shoota> so what's the error?
<wontruefree> `ld: symbol(s) not found for architecture x86_64`
<Yxhuvud> straight-shoota: omg @ that PR. seems you reacted to me pasting the RFC by actually reading it (and some followers?) :)
<FromGitter> <straight-shoota> yeah, I was already working on it before that^^
knight- has joined #crystal-lang
<knight-> hey hey
<FromGitter> <jwoertink> Is the `crystal tool expand` command is for showing all of the macros in the file expanded?
<Yxhuvud> uri:s are such a mess of a format.
moei has quit [Quit: Leaving...]
<FromGitter> <jwoertink> In any case, how do you run it? I've tried `crystal tool expand test.cr`, `crystal tool expand ./test.cr`, `crystal tool expand --stdin-filename=test.cr`, and I just keep getting the help menu
<oprypin> yeah i had the same experience
<Yxhuvud> `crystal tool expand -c file:row:column file_that_requires_everything_necessary`
* Yxhuvud wrote some of the wrappers of tool expand in the crystal elisp mode so that people wouldn't have to fight with that
<Yxhuvud> not that it works very well as the editor must know what file it is that requires everything, but anyhow.
<Yxhuvud> and by "know" I mean "guess".
<FromGitter> <jwoertink> hmm. ok, so `crystal tool expand -c test.cr:1:1 test.cr` runs (sort of). Just says "no expansion found". If my macro is on line 1 column 1, then this should do something, right?
<FromGitter> <jwoertink> or maybe I'm just not writing enough for it to do something
<FromGitter> <jwoertink> ah, ok, that's what it was. It's the line of where the macro is called, and not the macro itself
duane has joined #crystal-lang
<FromGitter> <j8r> Are Enum only about Int32 or can i change this to UInt8?
<FromGitter> <jwoertink> Haven't tried, but could you do `Red = 1_u8` inside the enum?
<FromGitter> <j8r> Nicely tried but doesn't work - It said it must be int32
<FromGitter> <jwoertink> ah damn. Maybe it's a bug?
pbodev1 has quit [Quit: ChatZilla 0.9.93 [Firefox 56.0/20170903140023]]
moei has joined #crystal-lang
<FromGitter> <talbergs> Hello community
<FromGitter> <talbergs> Im coming from php world, so im new to crystal
<FromGitter> <bendietze_twitter> Why should it be a bug? Is there a usecase for smaller Ints? I did not know if the internal representation is tweakable in other languages.. Enum internal knows only Int32 as far as i can see first look :)
<FromGitter> <talbergs> Could anyone please give a hand?
<FromGitter> <bendietze_twitter> Hey @talbergs sorry, my time is over, its middle of the night here - good start 😄 hope to see you next days 👍
<FromGitter> <bendietze_twitter> Means good start for you with Crystal
<FromGitter> <talbergs> Ok, good nite. (y)
<FromGitter> <bendietze_twitter> Thx ^^
<FromGitter> <talbergs> I want to pipe stdout into websocket as it arrives. ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5b3bfa7b7b811a6d63cd2faf]
<crystal-gh> [crystal] paulkass closed pull request #6306: Implemented #2770 (master...adding-punycode-to-openssl) https://git.io/fwlYe
<crystal-gh> [crystal] paulkass reopened pull request #6306: Implemented #2770 (master...adding-punycode-to-openssl) https://git.io/fwlYe
<FromGitter> <talbergs> See, the example above prints all in one take, ⏎ but I want it to be piped somehow. ⏎ This is my current attempt: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b3bfb87a99e1e52b713a7cb]
<FromGitter> <jwoertink> Hey @talbergs welcome to Crystal!
<FromGitter> <talbergs> Hey! Exciting project!
<FromGitter> <talbergs> Hope it rules the world soon.
<FromGitter> <jwoertink> When you say "websocket", do you mean https://crystal-lang.org/api/0.25.1/HTTP/WebSocket.html ?
<FromGitter> <talbergs> yes, but I use kemal for now. This my first day at crystal.
<FromGitter> <talbergs> Just to update you, I now managed this far. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b3c043c63042f2df3540213]
<FromGitter> <talbergs> So, I managed this shell thingy. ^^
<FromGitter> <jwoertink> I've never worked with websockets before, so I'm definitely not the right person to solve this one. I'm curious about the implementation though.
<FromGitter> <jwoertink> So you have a kemal app running, and a ws endpoint. Then you want a shell script to print to the ws channel each time?
<FromGitter> <talbergs> Basically yes. The GET to route will start a shell script and put update user on the output. ⏎ ⏎ Currently I need to dig out from api page, how to hook into a process again. Because if user calls GET again, and process is still running - I want to hook into it and continue updating user. ⏎ ⏎ In short my story is like so - I was smart enough to copy HTTP example from docs, and look up websocket API,
<FromGitter> ... but I could not at first figure, how these to will work concurrently so I went with kemal for now [https://gitter.im/crystal-lang/crystal?at=5b3c05a47b811a6d63cd44a7]
<FromGitter> <jwoertink> Looks like your script you have now does most of what you want. I'm assuming you'd replace the `puts o` with `socket.send o`. Then I guess it's just a matter of doing `break if rec.eof?`. There's no `eof?` method on IO::FileDescriptor, but you'd probably need something that tells when to break out of that while loop
<FromGitter> <talbergs> yes, exactly. I expected the `rec.gets` to give `nil` then, but my script now just hangs, I look at `.terminated?` inside that while loop, and it stays false =/. Yes there is no `eof?` method there. Just tested
greengriminal has quit [Quit: Leaving]
<FromGitter> <talbergs> ```code paste, see link``` ⏎ ⏎ surely i have no idea how to break out from that loop [https://gitter.im/crystal-lang/crystal?at=5b3c09b93572e970c1739860]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/fFuRi
<crystal-gh> crystal/master 735be7f Paul Kassianik: Implemented #2770 (#6306)...
<FromGitter> <drosehn> Hmm. I haven't tried Process.run in quite awhile, but I ran into a similar problem with something I was writing. (I don't remember what...). I ended up solving it by putting a `rescue` around the work I was doing inside the Process.run. In your case, that'd be a `begin ... rescue ... end` around the `while true ... end` loop.
<FromGitter> <talbergs> Rescue was for exception catching, thou still I'll try out your suggestion and report. I just realized I skipped the "concurrency" section when reading thru them docs this morning. I guess the fibers stuff may help me `spawn do rec.gets end ; process.wait`
<FromGitter> <drosehn> I didn't work on that program for long though. And while I was working on it, I always had the feeling that there must have been a better way to do what I was trying to do.