Re: [racket-users] Mandatory arguments for command-line

2015-11-14 Thread Matthias Felleisen
You really just want to call out from the case-lambda branches to other functions that are then designed according to what you want to parse, and you can then share pieces that are common to both branches. > On Nov 14, 2015, at 11:10 AM, Christopher Walborn wrote: > > Ok. So you're using c

Re: [racket-users] Mandatory arguments for command-line

2015-11-14 Thread Christopher Walborn
Ok. So you're using command-line in the body of the first case, and the-mandatory-argument takes the first word. Thanks to #:argv others, command-line can process the remaining ones. `./manage -h` would essentually give `racket -h` while `./manage anything -h` would give you help from command-l

Re: [racket-users] Mandatory arguments for command-line

2015-11-14 Thread Matthias Felleisen
It is not an either-or situation. Here is an alternative run where I combined case-lambda with command-line: > $ ./manage hello -t world -d good > (the-mandatory-argument: hello #t) > (-t #f) > (-d good) > (files: ()) The script is this now: #! /bin/sh #| exec racket -tm "$0" ${1+"$@"} |# #l

Re: [racket-users] Mandatory arguments for command-line

2015-11-13 Thread Christopher Walborn
Oh, interesting. There's several new things in there for me to explore. Thank you. (And nice Beatles reference.) If you don't mind explaining -- what are the trade-offs between this approach and using the arg parsing features of racket/cmdline? Thanks, Christopher -- You received this messag

Re: [racket-users] Mandatory arguments for command-line

2015-11-13 Thread Matthias Felleisen
Glad to hear you got this far. Consider using something like this: #! /bin/sh #| exec racket -tm "$0" ${1+"$@"} |# #lang racket (provide main) (define main (case-lambda [(the-mandatory-argument . others) (displayln `(the-mandatory-argument: ,the-mandatory-argume

Re: [racket-users] Mandatory arguments for command-line

2015-11-12 Thread Christopher Walborn
Thanks, Greg, that's helpful. By the way, I love racket-mode. DrRacket is a great environment, but I get frustrated editing text in anything but Emacs (or more recently Emacs with Evil via Spacemacs). Racket-mode provides enough support that I only switch into DrRacket when I've hit the wall with

Re: [racket-users] Mandatory arguments for command-line

2015-11-12 Thread Greg Hendershott
I don't know how to make the `command-line` syntax do this (there's no flag-clause like `#:required-once`). So I think I'd just do a normal test outside it: (define destination (make-parameter #f)) ;default to #f meaning "unspecified" (command-line your existing code ) (define (main)