Right, thank you for bringing that up. I should have mentioned that the #lang provides all of racket/base at the module level, so you can write normal Racket code (including `require`), and any imports at the module level would be available within the `program` body since it compiles down to a normal function.
You can also use `provide`, so once you define your command using `program`, you can provide it the same as any function. The client module requiring your command would need to be a #lang cli module (at least at the moment) so that it can actually run the imported command using `run`. On Sun, Jul 25, 2021 at 11:23 AM D. Ben Knoble <[email protected]> wrote: > > 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. >> > > Could we add require? I can think of two compelling reasons: > > 1. What else is available in the program form? All of racket, or just > racket/base? And either way, what if I want to use procedures from other > packages? > 2. What if I want to write a bunch of library code, and expose some of it > in a CLI script? I do this now in different ways: a module+ main that uses > code defined in the enclosing module, or a script that requires auxiliary > modules. Often the "body" of the program form isn't more than a call to a > "main" procedure: this enables me to provide that procedure as part of the > library, too. > > -- > 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/a0a0ffba-b8a5-4b57-8fc1-b24a821de85cn%40googlegroups.com > <https://groups.google.com/d/msgid/racket-users/a0a0ffba-b8a5-4b57-8fc1-b24a821de85cn%40googlegroups.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%3DQS%3DKu%3DZ-NfSLqmeOq8fb6FOcnA0GkL1xh-kT8WXw0-A%40mail.gmail.com.

