That's great to hear, Sage. My initial thrust here was to just get the syntax in place so that it worked the way it should, and I didn't give a lot of attention to the supporting implementation beyond that it should work correctly. I definitely see a possibility for big changes there and maybe even an intermediary layer between cli and racket/cmdline which could be natural-cli or something resembling it. I made some notes regarding the existing implementation and possible next steps in this issue <https://github.com/countvajhula/cli/issues/5>. Happy to discuss further and I appreciate your offer to collaborate.
On Sat, Jul 24, 2021 at 10:47 AM Sage Gerard <[email protected]> wrote: > Thank you for doing this. CLIs are an interesting beast, and I should be > available to contribute and/or comment next week. > > > *~slg* > > > > > > > -------- Original Message -------- > On Jul 24, 2021, 1:14 PM, Siddhartha Kasivajhula < [email protected]> > wrote: > > > Hello folks, > If you ever have a need to write a command line script in Racket, you may > be interested in the package I've just put up. Normally you'd write such > scripts using Racket's built-in command-line > <https://docs.racket-lang.org/reference/Command-Line_Parsing.html#%28form._%28%28lib._racket%2Fcmdline..rkt%29._command-line%29%29> > or > parse-command-line > <https://docs.racket-lang.org/reference/Command-Line_Parsing.html#%28def._%28%28lib._racket%2Fcmdline..rkt%29._parse-command-line%29%29> > form. > These offer a lot of functionality, but it takes time to learn how they > work and the syntax is somewhat idiosyncratic. So, I've written a #lang > that allows you to achieve the same functionality but with more familiar > and extensible syntax, #lang cli > <https://docs.racket-lang.org/cli/index.html>. > > The language is composed of 5 forms - help, flag, constraint, program, > and run. With these 5 forms, you get all of the functionality of the > built-in parse-command-line form, and with syntax that's much simpler. In > fact, the nontrivial forms of the language simply use Racket's normal > function definition syntax, so there's very little to learn -- you > basically write normal functions and they are implicitly wired to accept > their inputs via the command line. > > At the moment, the functionality offered is at parity with the built-in > forms, but there are some planned additions that would make it more > powerful, including composable commands > <https://github.com/countvajhula/cli/issues/3>, generalized constraints > <https://github.com/countvajhula/cli/issues/6>, and argument schemas > <https://github.com/countvajhula/cli/issues/7>. > > So if you write command line scripts, I encourage you to give it a try. > > I also coincidentally came across the package natural-cli > <https://docs.racket-lang.org/natural-cli/index.html> by Sage Gerard. > Looks like it provides some interesting features and in particular > subcommands, which are absent in #lang cli. It very well may be that this > package should be leveraged for semantics in #lang cli in the future (Sage > if you'd like to add anything about what this package offers, please do). > > Enjoy, > -Sid > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/CACQBWFnevJaRg61xLv6ayps-ihGpuUFUFEVbLTH7m929tpex3Q%40mail.gmail.com > <https://groups.google.com/d/msgid/racket-users/CACQBWFnevJaRg61xLv6ayps-ihGpuUFUFEVbLTH7m929tpex3Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CACQBWF%3D9bQpNpc2ShAcARtuz0y7%3DvHuiyiU17eafx5DZ%3D6DKzA%40mail.gmail.com.

