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 joined #crystal-lang
riza has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
notzmv has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
Vexatos_ has joined #crystal-lang
oprypin_ has joined #crystal-lang
jhass- has joined #crystal-lang
jhass has quit [Ping timeout: 256 seconds]
riza has quit [Ping timeout: 256 seconds]
notzmv has quit [Ping timeout: 256 seconds]
jhass- is now known as jhass
oprypin has quit [Ping timeout: 256 seconds]
Vexatos has quit [Ping timeout: 256 seconds]
ua_ has quit [Ping timeout: 256 seconds]
riza has joined #crystal-lang
ua_ has joined #crystal-lang
notzmv has joined #crystal-lang
ua_ has quit [Ping timeout: 268 seconds]
ua_ has joined #crystal-lang
ur5us has joined #crystal-lang
hightower2 has joined #crystal-lang
ur5us has quit [Ping timeout: 246 seconds]
ur5us has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
sweatshirt has quit [Ping timeout: 265 seconds]
hightower2 has quit [Remote host closed the connection]
jmdaemon has quit [Ping timeout: 264 seconds]
<FromGitter> <skinnyjames> Hi all, does anyone know of a good way to type an array of generic classes which is populated with an instance method using (forall)? ⏎ context here: https://play.crystal-lang.org/#/r/e7ts ⏎ ⏎ Bonus: i was mucking around and did a bad here: https://play.crystal-lang.org/#/r/e7tt [https://gitter.im/crystal-lang/crystal?at=63932f6a2b937b1a2eb2476d]
Sankalp has quit [Read error: Connection reset by peer]
Sankalp has joined #crystal-lang
<FromGitter> <naqvis> > Hi all, does anyone know of a good way to type an array of generic classes which is populated with an instance method using (forall)? ⏎ > context here: https://play.crystal-lang.org/#/r/e7ts ⏎ > ⏎ https://play.crystal-lang.org/#/r/e7ug [https://gitter.im/crystal-lang/crystal?at=6393395b2b937b1a2eb25998]
<FromGitter> <naqvis> but such approach is quite fragile
<FromGitter> <naqvis> also in your class you have restricted the types which `Options` array can hold, but `add` method isn't imposing any restriction, so it might break for cases where you call `add` with type which isn't part of your expected types.
<FromGitter> <naqvis> https://play.crystal-lang.org/#/r/e7ul ⏎ ⏎ this snippet contains a macro check for `add` method and ensure only allowed types are allowed at compile time. So if you try invoking `add` method with Types which aren't part of `Type` alias, it will fail to compile.
<FromGitter> <naqvis> e.g. invoking `add` with `Int64` will raise compile time error. ⏎ ⏎ https://play.crystal-lang.org/#/r/e7um
<FromGitter> <skinnyjames> Ah, thanks. ⏎ ⏎ > also in your class you have restricted the types which Options array can hold, but add method isn't imposing any restriction, so it might break for cases where you call add with type which isn't part of your expected types. ⏎ ⏎ Good call, I'd actually be fine without such restriction; just an array of OptionBuilder(T). I'd like to use the type to cast string values to (T), but
<FromGitter> <Blacksmoke16> are a few CLI shards out there if that would be easier than rolling your own
<FromGitter> <skinnyjames> > are a few CLI shards out there if that would be easier than rolling your own ⏎ ⏎ Ah yeah, I did take a look. I'll take another glance now that I have a better idea of what I'd like to do.
<FromGitter> <Blacksmoke16> looking for something in particular?
<FromGitter> <skinnyjames> > looking for something in particular? ⏎ Was looking for something lightweight, extensible and up to date with latest Crystal. ⏎ ⏎ I was looking into Admiral and Commander, but I think I'm going to poke around the docs for Athena console. ⏎ I want to attach a CLI to a task runner (base/abstract class), but also be able to compose (sub)commands across implementations of the task runner.
<FromGitter> <Blacksmoke16> 👍 sounds good. let me know if you have any questions about it.
<FromGitter> <Blacksmoke16> most of the builders in that list mainly just focus on the arg/option parsing side of a CLI, athena's console component is more of a CLI framework in that it provides extra common utilities. Like for formatting/styling output, testing aids, creating tables, asking questions, etc
<FromGitter> <Blacksmoke16> the one catch is it doesnt exactly support sub commands, but uses `:` as a way to group related commands. E.g. `admin:create-user` or `admin:sync-data`, etc
<FromGitter> <skinnyjames> Nice, I'm a big fan of the TTY toolkit (https://ttytoolkit.org/) in ruby; haven't thought much about prompts etc.
<FromGitter> <Blacksmoke16> the question type docs would have more details of how they work. Or ofc easy enough to just play around with it
Starfoxxes has quit [Ping timeout: 252 seconds]
Starfoxxes has joined #crystal-lang
<FromGitter> <moe:busyloop.net> maybe https://github.com/busyloop/cliq can help (it's built around the idea of composition)
hightower2 has joined #crystal-lang
_ht has joined #crystal-lang
_ht has quit [Quit: _ht]
jmdaemon has joined #crystal-lang