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
ur5us has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> @jfontan:matrix.org https://github.com/crystal-lang/crystal/issues/8123
ur5us has joined #crystal-lang
<FromGitter> <nanobowers> Can anyone recommend a shard for getting terminal columns/rows? I'd prefer to do it in a cross platform way without having to start a process and call `tput`. I think there's a lightweight ioctl library, but would rather something a little more wrapped if possible.
<FromGitter> <nanobowers> In case it matters, I was using IO::Console back in ruby to do this.
SamantazFox has quit [Killed (NickServ (GHOST command used by SamantazFox_))]
SamantazFox_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> @watzon had a shard for that but i once again cannot remember the name of it
<FromGitter> <Blacksmoke16> https://github.com/crystal-term/screen found it
<FromGitter> <nanobowers> Thanks @Blacksmoke16, much appreciated.
notzmv has quit [Read error: Connection reset by peer]
notzmv has joined #crystal-lang
notzmv is now known as zimmybot
zimmybot is now known as notzmv
notzmv has quit [Remote host closed the connection]
notzmv has joined #crystal-lang
elf_fortrez has joined #crystal-lang
elf_fortrez has quit [Quit: Client closed]
<FromGitter> <mixflame> raz: It was Redis based remote execution with the code being run inside Redis or breaking the adapter with raw code
ur5us has quit [Ping timeout: 252 seconds]
elf_fortrezz has joined #crystal-lang
elf_fortrezz has quit [Quit: Client closed]
<hightower4> nanobowers also check https://github.com/crystallabs/crysterm (it's a bit more than just terminal size :)
<hightower4> (although at the moment, for terminal size, it uses Term::Screen to which you've already been pointed)
hightower3 has joined #crystal-lang
hightower4 has quit [Ping timeout: 252 seconds]
sorcus has quit [Ping timeout: 245 seconds]
elf_fortrez has joined #crystal-lang
elf_fortrez has quit [Client Quit]
elf_fortrez has joined #crystal-lang
ur5us has joined #crystal-lang
elf_fortrez has quit [Ping timeout: 246 seconds]
ur5us has quit [Ping timeout: 240 seconds]
sorcus has joined #crystal-lang
hightower3 has quit [Ping timeout: 250 seconds]
dom96 has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
Stephie has quit [*.net *.split]
Stephie has joined #crystal-lang
dom96 has joined #crystal-lang
jrayhawk has joined #crystal-lang
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #crystal-lang
<FromGitter> <alexherbo2> is there a support for json lines?
<FromGitter> <alexherbo2> https://jsonlines.org
hightower2 has joined #crystal-lang
Liothen has quit []
Liothen has joined #crystal-lang
<FromGitter> <alexherbo2> @Blacksmoke16 could it work to assign `io = IO::Delimited.new(memory_io, '\n')` so we can `pp Resource.from_json(io)`?
<FromGitter> <Blacksmoke16> that would work yes
<FromGitter> <Blacksmoke16> just keep in mind you'd need more than 1 `IO::Delimited` in order to parse multiple objects, and parsing an array of them might be a bit trickier as well
<SamantazFox_> https://bpa.st/EXTQ
<SamantazFox_> Why is T.new a thing in `from_json`, but not in `from_yaml`?
<SamantazFox_> (I'm getting "Error: undefined method 'new' for T.class")
<FromGitter> <Blacksmoke16> the constructor for YAML is diff than JSON
<SamantazFox_> *facepalms*
<SamantazFox_> thanks for the pointer :)
<SamantazFox_> Uh, changing to `T.new ctx, node` gives the same eroor...
<FromGitter> <Blacksmoke16> does that type include `YAML::Serializable`
<SamantazFox_> yes
<FromGitter> <Blacksmoke16> does the type include both?
<FromGitter> <Blacksmoke16> if you have a type that only includes one or the other, the error would make sense
<SamantazFox_> https://bpa.st/TXIQ
<SamantazFox_> Here is my class. there are `require` statements for `json` and `yaml` at the top of the file
<FromGitter> <Blacksmoke16> `converter: Settings::Converters::Generic` dont you also need to supply the generic?
<SamantazFox_> the generic module is my first paste
<SamantazFox_> (https://bpa.st/EXTQ
<SamantazFox_> except that I changed L31 from `T.new node` to `T.new ctx, node`
<FromGitter> <Blacksmoke16> right, but shouldn't it be like `converter: Settings::Converters::Generic(MyType)`
<SamantazFox_> Oh.
<SamantazFox_> I thought that it was automatically done, using the type of the property
<FromGitter> <Blacksmoke16> not sure, i wouldn't have thought so
<FromGitter> <Blacksmoke16> yea it doesnt, `T` is basically an uninstantiated generic afaik
<FromGitter> <Blacksmoke16> kinda surprised it compiles
<SamantazFox_> the weird thing is that my code did compile when that file was alone (`require`-ing it within an `eval` statement), but now it doesn't...
<SamantazFox_> Well, yep, providing the type did it.
<SamantazFox_> Though, it's sad that annotations require the full namespace...
<SamantazFox_> it makes the code horrible to read
<FromGitter> <Blacksmoke16> :shrug: could be worse
<SamantazFox_> anyway, thanks for the help :)
<FromGitter> <Blacksmoke16> np
<FromGitter> <RespiteSage> @oprypin Very satisfying to add screenshots to my crsfml-based visualization tool with only five lines.
<FromGitter> <RespiteSage> Thanks again for writing those bindings.
Guest42 has joined #crystal-lang
Guest42 has quit [Ping timeout: 246 seconds]
<FromGitter> <oprypin:matrix.org> 😊
<FromGitter> <alexherbo2> `FileUtils` does not seem to accept paths, despite the `Path | String`
<FromGitter> <alexherbo2> https://crystal-lang.org/api/1.1.0/FileUtils.html#cp(srcs:Enumerable(Path%7CString),dest:Path%7CString):Nil-instance-method
<FromGitter> <alexherbo2> `Error: no overload matches 'FileUtils.cp' with types Array(String), Path`
<FromGitter> <Blacksmoke16> the problem is the array
<FromGitter> <Blacksmoke16> `Array(String)` is *NOT* the same thing as `Array(String | Path)`
<FromGitter> <HertzDevil> but this is a restriction so it should match
<FromGitter> <HertzDevil> i get a different error though
<FromGitter> <HertzDevil> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=61254c9013ac9b6b83913e37]
<FromGitter> <Blacksmoke16> interesting
<FromGitter> <HertzDevil> it matches, and then that `Enumerable` overload calls the other overload
<FromGitter> <HertzDevil> then `def cp(src_path : Path | String, dest : Path | String)` doesn't accept `src_path : String` and `dest : Path` it seems
<FromGitter> <HertzDevil> looks like that's fixed on master
<FromGitter> <HertzDevil> crystal-lang/crystal#10783
<FromGitter> <Blacksmoke16> nice! well there go
ur5us has joined #crystal-lang
<hightower2> Hey is anyone aware of a "snapshot" shard for testing? That thing where you'd run something and save results to a file (and commit to version control), and then on subsequent runs if the file is there you'd compare the current run to saved contents
<FromGitter> <Blacksmoke16> and what if they arent the same?
<hightower2> that's a failed test... how to solve it is a different matter then. One can either fix the code, or delete the file to cause the current version to become the new valid result. Also some module offers a way to update it to the current value via commands/options, without literally going and deleting files to cause their re-creation
<hightower2> Like here's one lib for this for python: https://github.com/syrusakbary/snapshottest
<FromGitter> <oprypin:matrix.org> or https://github.com/oprypin/pytest-golden
<FromGitter> <oprypin:matrix.org> yea it seems woefully missing, despite the amazing possibilities that Crystal has to help with this
<FromGitter> <oprypin:matrix.org> i once started such a project. all i have is just a decent enough pun to use for the project's name
<hightower2> what stopped you, lack of time or?
<FromGitter> <oprypin:matrix.org> hmm feature creep and lack of motivation at the same time
<hightower2> My immediate need atm is to add snapshot tests for https://github.com/crystallabs/crysterm ... There are many test programs written, and instead of adding individual tests I just want to automate running/checking those programs (i.e. run them, save all stdout to file, then compare on further runs)
<FromGitter> <oprypin:matrix.org> hightower2, it's quick to implement. just loop on files, read something from them and assert
<hightower2> yeah, sure... I just wanted something more "official", to learn using some existing tool as a side benefit, rather than doing it wild west style
<hightower2> but yeah, could do that
<FromGitter> <Blacksmoke16> KISS, just manually create the file and do the assertion and deal with automation later when/if it becomes an issue
<FromGitter> <Blacksmoke16> ideally it would never fail 😉
<FromGitter> <oprypin:matrix.org> & good for me to know that people call it "snapshot tests". i looked for "golden tests" for ages and thought almost nobody does it
<FromGitter> <oprypin:matrix.org> well "almost nobody" can still be said but yea
<hightower2> :)
<FromGitter> <oprypin:matrix.org> hightower2, fwiw overwriting should also be easy, just check for a passed -D flag and then overwrite instead
<FromGitter> <oprypin:matrix.org> slightly less easy is deciding how to put both input and output into the same file
<FromGitter> <Blacksmoke16> `input, output = File.read_lines("foo.txt')`
<hightower2> ++
<hightower2> "despite the amazing possibilities that Crystal has" <-- you mean anything in particular, or in general the convenience of crystal for that job?
<FromGitter> <oprypin:matrix.org> hightower2, with macros you can make amazing extra features. one idea perhaps: write updated values back into *source code*
krobin has left #crystal-lang [WeeChat 2.3]