jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.28.0 | 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
<oprypin_> alex``: `my-command -- bash -c 'echo "$1" "$2"'`
<oprypin_> `git bisect run` style
<oprypin_> what do these %1 stand for anyway?
<alex``> oprypin_: in and out
<oprypin_> lol that's not how shell_escape works
<alex``> no I forget "'" + escape + "'"
<oprypin_> yeah no
<oprypin_> where do i begin...
<alex``> :(
<oprypin_> run ["sh", "-c", modify, "--", in_, out_]
<oprypin_> and the command will be expected to use $1 $2
<oprypin_> you do absolutely no formatting or escaping (srsly pls don't)
<oprypin_> that list is for Process.run, don't use `system` ever
<alex``> modify could be `echo "$2" "$1"`?
<oprypin_> yeah it could
<alex``> one sh per element :(
<oprypin_> that's what `system` does anyway
<alex``> I call system once
<oprypin_> ah well then u could specify multiple -c flags
<alex``> what do you think of the ability to write the output (generated commands) to a file?
<oprypin_> don't pls
<oprypin_> I'd accept if you were to take this same list and *properly* shell-escape it (which i don't think there's a lib for in Crystal) and write it to a file
<alex``> do you know ranger file manager bulk feature?
<alex``> they uses the same technique as me
<alex``> writing to a file is that a bad idea?
<oprypin_> why do you care about writing to a file?
<alex``> to be sure of the output before executing the commands
<oprypin_> run ["sh", "-c", "echo " + remain, "-c", "echo " + modify, "--", in_, out_]
<oprypin_> got u a better one
<alex``> (output at 06:44)
<oprypin_> run ["sh", "-c", "printf %q " + remain, "-c", "echo", "-c", "printf %q " + modify, "-c", "echo", "--", in_, out_]
<oprypin_> are u writing this down? lol
<oprypin_> this is top tier stuff
<oprypin_> just try this with Process.run and any variables
<oprypin_> u can pipe it to a file too
<alex``> I had an old project, named Bulk in Ruby doing similar thing but much featured
<alex``> I want to rewrite and simplify in Crystal
<alex``> wow %q is nice
<oprypin_> looks like exactly what i always wanted
<oprypin_> the project
<alex``> it is not limited to files (internally it has no concept of files, but argument)
<oprypin_> but ye I'm typing all this from mobile s
<alex``> I often used Bulk to renames, and share torrents
<oprypin_> and not testing it but I'm sure it works
<alex``> with a "relink" command
<alex``> so I can download torrent animes, move the files to ~/videos/animes/path/to, and relink to ~/torrent/weird-names
<alex``> oprypin_: you want I pm you when I have the project clean/sharable?
<oprypin_> hmm I'll be too much NI
<oprypin_> NI
<oprypin_> omg
<oprypin_> too NIH about it
<oprypin_> that's how typing on an edge-to-edge screen looks like
<alex``> which client are you using?
<oprypin_> quassel quasseldroid
<alex``> you confused me with your ["sh", "-c", "printf %q " + remain, "-c", "echo", "-c", "printf %q " + modify, "-c", "echo", "--", in_, out_] approach xd
<oprypin_> just put it into a Crystal source file
<oprypin_> in_ = "aa"; out_ = "b b"
<oprypin_> remain = %[touch "$1"]
<alex``> I hesitate too with this:
<oprypin_> modify = %[cp "$1” "$2"]
<alex``> create shell 'modify', 'remain', 'delete' function on top of the output file
<alex``> and
<alex``> delete() {
<alex``> ...
<alex``> }
<oprypin_> that can work yeah
<alex``> delete "blabla" "bla"
<alex``> delete "foo" "bar"
<alex``> which UI is nicer to you?
<oprypin_> at that point it's all shell
<alex``> yes
<oprypin_> oh shit, sun is starting to rise
<alex``> xd
<oprypin_> mhm
oprypin_ is now known as oprypin
<alex``> :|
<alex``> you suggest to write a out.cr file to compile?
<alex``> posix shell is tempting for this task
<alex``> oprypin: btw you have a better name than --remain, --modify, --delete to suggest?
<alex``> I think I will go with --remain, --modify, --delete being the body of the functions
<alex``> fd --type file | batch --modify 'rename "$1" "$2"'
<alex``> (with rename being a shell script in scripts/ to create parent directories, cleaning with rmdir --parents
<alex``> you tested https://thelounge.chat?
<alex``> the config is quite minimal https://github.com/alexherbo2/configuration/blob/master/home/thelounge/config.js (~/.thelounge/config.js)
<alex``> oprypin: 02:35:50 oprypin_ | just try this with Process.run and any variables | u can pipe it to a file too
<alex``> I was using this to pipe Chrome tabs to dmenu yeah
<alex``> about Process.run vs system (with argument), I find system nice because it out of the box launch a ncurse editor
<alex``> with Process.run I guess it is more cucumbersome, because of tty
<alex``> system(editor, { file })
<alex``> Process.run(editor, { file }, output: STDOUT)
<alex``> what is the syntax for Array(Array(String)) to initialize an empty array?
<alex``> [] of [] of String?
<alex``> found it I guess @arguments : Array(Array(String)) = [] of Array(String)
<FromGitter> <watzon> Yup that's it
Seich has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
tannakartikey has joined #crystal-lang
chemist69 has quit [Ping timeout: 258 seconds]
chemist69 has joined #crystal-lang
_whitelogger has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.4]
<FromGitter> <watzon> Much lines
rohitpaulk has joined #crystal-lang
laaron has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 248 seconds]
laaron has joined #crystal-lang
tannakartikey has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 258 seconds]
kartikey has joined #crystal-lang
<FromGitter> <j8r> mps how can we have a 0.28.0 archive in https://dev.alpinelinux.org/archive/crystal for boostrapping, 0.29.0 is released
<FromGitter> <watzon> Woooo
<mps> j8r: there are two ways, first I ask someone who have dev.a.o write access to run 'abuild snapshot'
<mps> second is to ask admin to give me write rights there, but I didn't asked because I dislike ask for rights and usually I wait till it offered to me
<jhass> you can have j8r ask to give them to you xD
<mps> but now, looks like I should 'break my own rule' and ask
<mps> jhass: sounds like good idea
<mps> it is not a problem, I will got it if I ask but didn't till now
<FromGitter> <j8r> haha :)
<FromGitter> <j8r> maybe there is a better may
<FromGitter> <j8r> is it possible to have crystal as a dev dependency, then compiling the new compiler with the old one?
<mps> I started to work on this but didn't finished because of 'not fine' dependencies handling in alpine
<mps> new shards is not released yet?
<mps> btw, should I force 0.29.0 for stable Alpine which will be released soon?
<FromGitter> <j8r> what do you mean by force?
<FromGitter> <j8r> it's not even on edge :/
<mps> because we are in freeze cycle, and usually we don't add new pkg's, we do bug fixes only, well mostly
<mps> sorry, I wasn't clear, just drinking my first morning coffee (and brandy :) )
<FromGitter> <j8r> On my side, it doesn't really matter. My CIs are based on latest, with crystal and shards from edge.
<FromGitter> <bew> @bcardiff what do you mean by `And it works across all files included from the main file after the cursor location` (in "Tools") ?
ashirase has quit [Ping timeout: 245 seconds]
ashirase has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <mwlang> In documenting code, is there a way to reference classes without emitting the whole hierarchy? For example, my Binance shard, I don't want to litter the README documentation I would rather just display `ServerResponse` rather than `Binance::Responses::ServerResponse`, but have it link to the former.
<FromGitter> <girng> Hello!!
<FromGitter> <mistergibson> Hello
<FromGitter> <mistergibson> I too have wondered about GoDot written in Crystal
<FromGitter> <girng> @mistergibson i'm pretty sure @Blacksmoke16 will know this
<FromGitter> <mistergibson> We need to expand the platform reach of Crystal prior to the attempt though ... all in due course
<FromGitter> <girng> @mistergibson yeah i agree
<FromGitter> <girng> how is everyone doing? what are ya'll working on
<FromGitter> <mistergibson> I'm good --> just learning about Crystal from the beginning. I'm looking for design patterns using channels and fibers. I get the basic concept, just not sure yet how to USE them.
<FromGitter> <mistergibson> I get Ruby threads and mutexes -- just takes a bit of a shift to get channels/fibers/flow-control between fibers
<FromGitter> <girng> your name sounds familiar have you been here before?
<FromGitter> <mistergibson> yes, I lurk
<FromGitter> <mistergibson> ask silly n00b questions, and hang about like a bad smell ;)
<FromGitter> <girng> i still have never used channels before, lol. i do use fibers though
<FromGitter> <girng> i'm the opposite, i still need to understand mutexes
<FromGitter> <bararchy> This example is what helped me get Fibers and Channels
<FromGitter> <mistergibson> thanks @bararchy
<FromGitter> <bararchy> np :)
<jokke> where is `with <something> yield` documented?
<jokke> jhass: thanks!
<jokke> jhass: ruby can't do this, correct?
<jokke> jhass: can the default receiver be overwritten in subsequent yields?
<jhass> didn't get you
<jokke> this doesn't call to_s on the div
<jokke> also this doesn't even compile
<jhass> https://carc.in/#/r/71fp looks like we got a compiler bug there, yeah
<jokke> also, is there a way to explicitly access the default receiver?
<jokke> (for passing it on)
<jhass> should be self
<jokke> oh ok
<jokke> hm there's no self in this scope
<jhass> text = "foo" just assigns a local variable
<jhass> it doesn't call Element#text=
<jokke> yeah
<jokke> but here is where i get no self in this scope
<jhass> well the common pattern then is to just with x yield x
<jokke> jhass: hm k
<jokke> makes sense
<jhass> or avoid the =
<jhass> text "foo"
<jokke> yeah
<jokke> ok
<jokke> ic
<jokke> ah
<jokke> yeah like this it works: https://p.jokke.space/YmyHd/
<jhass> btw any reason you're reinventing https://github.com/crystal-lang/html_builder ?
<jokke> jhass: nono, this was just an example
<FromGitter> <Blacksmoke16> @mwlang should just have to do like ``ServerResponse``
alex`` has joined #crystal-lang
greengriminal has joined #crystal-lang
<FromGitter> <bcardiff> @bew ⏎ ⏎ > what do you mean by And it works across all files included from the main file (...) ⏎ ⏎ You can read that it as if it works in real projects, not only single files. But will only performa lookup through the files that are effectively used during a compilation of the main file. [https://gitter.im/crystal-lang/crystal?at=5cf912d3cea8295279018453]
RX14- is now known as RX14
ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | 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> <kinxer> @bcardiff ⏎ Why was this not implemented in 0.29.0? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5cf91cf7faac6439344d7e5c]
<FromGitter> <r00ster91> I'm also confused why the overflow error is still not raised by default
<FromGitter> <kinxer> ^
<FromGitter> <bcardiff> @kinxer because there are other things in the pipeline. ⏎ and @r00ster91 I want to turn them on but we need to bump llvm and embed compiler-rt. ⏎ ⏎ With this two features in particular, I didn't get that people care about them. Althought I am really convinced they are good thing to have :-). [https://gitter.im/crystal-lang/crystal?at=5cf9206aff3f016baab527ae]
<FromGitter> <kinxer> Other things in the pipeline?
<FromGitter> <bew> @bcardiff ok I see, what about the end of the line "after the cursor location" ? I don't see why you mention "after" or "the cursor location"
<FromGitter> <bcardiff> @bew in the CLI after the `--cursor fileA.cr:LINE:COL fileMain.cr` I meant the fileMain.cr that is after the cursor location `fileA.cr:LINE:COL`
alex`` has quit [Ping timeout: 248 seconds]
alex`` has joined #crystal-lang
kartikey has quit [Ping timeout: 248 seconds]
<FromGitter> <bew> oooooh ok, I'd suggest to remove that part, it's so confusing since you don't say you're talking about the cli.. Or maybe reword like this: ``And it works across all files included from `minion.cr` (the last parameter)`` (not better actually..)
<FromGitter> <bew> Or `And it works across all files included from the main file (after the given --cursor location)`
<alex``> where I can find the list of operators in the source code?
<alex``> I found it here
<alex``> there is other source than symbol?
moei has joined #crystal-lang
DTZUZU has quit [Ping timeout: 252 seconds]
DTZUZU has joined #crystal-lang
DTZUZU has quit [Ping timeout: 248 seconds]
alex`` has quit [Ping timeout: 272 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
DTZUZU has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <Prutheus> How to unescape a string like this: "\"[{\\\"status\\\": \\\"DONE\\\", \\\"loc\\\": 1 ....
<FromGitter> <Prutheus> I mean how to get the inner string of that?
<FromGitter> <Prutheus> [{"status":...
<alex``> z64: I wanted something automatic, fetching from the source directly
<alex``> I update the keywords directly from Crystal sources
<FromGitter> <mavu> if I build crystal compiler locally, do I need to update the behmgc sources too when I update crystal? (i.e. I originally compiled and installed the gc sources when I compiled crystal 0.27.2, and have not updated them since.)
<FromGitter> <mavu> if that needs to be updated, is there any place where I can see the correct boehmgc version that should be used with a specific crystal version?
<FromGitter> <watzon> Just had a very nice conversation with Martin over at Manas. I think I've got a good shot :)
<FromGitter> <r00ster91> did you talk about Crystal?
<FromGitter> <watzon> Si senor
<FromGitter> <watzon> Among other things
<FromGitter> <mistergibson> @watzon : you a prospect for hire?
DTZUZU has quit [Ping timeout: 252 seconds]
<FromGitter> <watzon> Yep 😄
<FromGitter> <mistergibson> Good luck to you
<FromGitter> <watzon> Thank you
<FromGitter> <mistergibson> Keep us posted so we have an excuse to drink ;)
<FromGitter> <watzon> Hahaha do you need an excuse?
<z64> alex``: oh ok. not sure then; probably looking at the parser i would guess, for example https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/syntax/parser.cr#L516
DTZUZU has joined #crystal-lang
<alex``> z64: I guess they are all in AtomicWithMethodCheck no?
<z64> i don't know; i'm wholly unfamiliar with the compiler internals & there isn't documentation
greengriminal has joined #crystal-lang
DTZUZU has quit [Ping timeout: 248 seconds]
DTZUZU has joined #crystal-lang
Raimondi has joined #crystal-lang
DTZUZU has quit [Ping timeout: 248 seconds]
DTZUZU has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
<FromGitter> <Prutheus> How to unescape a string like this: "\"[{\\\"status\\\": \\\"DONE\\\", \\\"loc\\\": 1 .... ⏎ I mean how to get the inner string of that? ⏎ [{"status":...
<FromGitter> <Prutheus> ^ is what I want to get.
DTZUZU has quit [Ping timeout: 258 seconds]
<FromGitter> <Blacksmoke16> is that the actual string, or are you using `pp`?
<FromGitter> <Prutheus> it is the string :/
DTZUZU has joined #crystal-lang
<FromGitter> <Blacksmoke16> hm
<FromGitter> <tenebrousedge> `gsub("\\", "")` ?
<FromGitter> <Prutheus> @tenebrousedge "\"[{\"status\": \"DONE\", \"loc\": 1,
<FromGitter> <Prutheus> still not what it should look like
<FromGitter> <Blacksmoke16> might have to use 4 `]`
<FromGitter> <Blacksmoke16> or
<FromGitter> <Blacksmoke16> is your string ever going to have a `\` in it?
<FromGitter> <Prutheus> no
<FromGitter> <Blacksmoke16> `gsub('\', "")`
<FromGitter> <Blacksmoke16> try that
<FromGitter> <Prutheus> Syntax error in :2: unterminated char literal, use double quotes for strings ⏎ CLOSE
<FromGitter> <Prutheus> xD
<FromGitter> <r00ster91> `delete('\\')`
<FromGitter> <Blacksmoke16> i like that better
<FromGitter> <Blacksmoke16> and yea, would need two of them
<FromGitter> <tenebrousedge> @Prutheus were you using `pp` to check that?
<FromGitter> <r00ster91> no wait, `delete('\\\')`
<FromGitter> <Blacksmoke16> first one would work, would delete all `\`
<FromGitter> <r00ster91> no `'\\'` gives `unterminated char literal, use double quotes for strings`
<FromGitter> <tenebrousedge> yes, you need to use double quotes for strings
<FromGitter> <Prutheus> .delete("\\")[1..-2]
<FromGitter> <Prutheus> thanks
DTZUZU has quit [Ping timeout: 246 seconds]
DTZUZU has joined #crystal-lang
<FromGitter> <bararchy> what did we break with `require` now? XD
<FromGitter> <fernandes> quick question on something that I'm seeing but not seeing hahah how use `strict = true` on JSON.mapping ?
<FromGitter> <tenebrousedge> https://crystal-lang.org/api/0.23.1/JSON.html#mapping%28properties%2Cstrict%3Dfalse%29-macro
<FromGitter> <fernandes> yeah, I was using it wrongly, I usually forget crystal is written in crystal hahah the spec saved me
<FromGitter> <tenebrousedge> 👍
<mps> j8r: build of 0.29.0 failed in 'abuild check', with this http://tpaste.us/P0D1
<alex``> where I can find the list of macros?
<alex``> getter/setter/property are keywords or macro?
DTZUZU has quit [Ping timeout: 258 seconds]
<FromGitter> <jwoertink> those are macros
<FromGitter> <jwoertink> sort of hard to read in the source
Groogy has joined #crystal-lang
<Groogy> Yo been a while!
<Groogy> Completly forgotten how but if I have a C lib function, it returns a LibC::Char*, how do I convert that to a string?
<woodruffw> Groogy: i *think* there's an overloaded String.new constructor for LibC::Char*
<Groogy> ah yesah yes, thx
<alex``> jwoertink: and the list of types?
<Groogy> back to binding assimp then
<FromGitter> <jwoertink> No clue about list of types.
<FromGitter> <jwoertink> You might have access to ancestors at the macro level? But I've never tried it, so that's purely a guess
<Groogy> yeah you do, I exploit it in one of my libs but been a while since I fiddled with it
<Groogy> if you can somehow get a type node in the macro (@@type I think in a macro will get you self type I believe)
DTZUZO has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter> <watzon> Does crystal have anything like Ruby's `URI.encode_www_form`?
moei has quit [Quit: Leaving...]
<FromGitter> <watzon> Nvm
<alex``> watzon you managed to make kakoune working?
<FromGitter> <watzon> Yeah, but it's not quite far enough along for me
<FromGitter> <watzon> I prefer vim for now
<alex``> I updated the support for Crystal
<alex``> it’s pretty complete now
alex`` has quit [Read error: Connection reset by peer]
alex`` has joined #crystal-lang
<FromGitter> <watzon> @alex
<FromGitter> <watzon> alex`` I mean as far as the plugin system and such
<FromGitter> <watzon> I like having a file tree specifically
<alex``> watzon you can have
<alex``> you can connect the file explorer of your choice and it opens in the right client
<alex``> :connect ranger
<alex``> to open ranger file manager, when you open a file, it will open the file in the client
<alex``> it works with anything that uses EDITOR
<alex``> even from the shell, with 'edit'
<alex``> :connect (pop up a terminal), when you open a file it opens in the client from where you ran :connect
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron- has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<Groogy> ugh there assimp binding done, now I just need to create the nice crystal layer
<alex``> what is the recommended way to copy the contents of a file?
<alex``> I have an input_file (temp) and want to create another tempfile (output_file) with the content of input_file
<alex``> `output_file = File.tempfile("output", ".txt") do |file| file.puts File.read(input_file.path) end` is the way to do?
<FromGitter> <tenebrousedge> I think there's an IO#pipe that might avoid reading
<alex``> how do you use it tenebrousedge?
<FromGitter> <Blacksmoke16> Pretty sure there is a copy method
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.28.0/IO.html#copy%28src%2Cdst%29-class-method
<alex``> in the block, `file.copy input_file`?
<FromGitter> <Blacksmoke16> prob just like
<FromGitter> <Blacksmoke16> ```output_file = File.tempfile("output", ".txt") ⏎ IO.copy input_file, output_file``` [https://gitter.im/crystal-lang/crystal?at=5cf9a6ef702b7e5e76401c8a]
<FromGitter> <Blacksmoke16> let me try it
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5cf9a76dff3f016baab8fb55]
<FromGitter> <Blacksmoke16> like that
<alex``> oh thanks
<FromGitter> <Blacksmoke16> np
<alex``> I don’t understand how IO.pipe would have worked
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/IO/MultiWriter.html could also depending on what you're doing
<FromGitter> <Blacksmoke16> would allow writing to both
<alex``> instead of passing a block, I would do:
<alex``> writer = IO::MultiWriter.new(input_file, output_file)