[plt-dev] rico

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Apr 4 11:10:26 EDT 2010

I've committed a first attempt at `rico' in SVN, so you can try out
`rico setup' instead of `setup-plt', `rico make' instead of `mzc', etc.

There's no documentation, yet, because I'll start by converting the mzc
docs, and I'm not yet ready to convert docs. For now, here's how you
plug in new commands:

In an "info.ss" file, define `rico' as a list of commands, where each
command is

   (list <command-string>

If the last element is #f, the command doesn't show up in the list of
frequently used commands that `rico' prints by default. If it's a
number, then it's printed in the list of commands and sorted by number
(with higher numbers earlier in the list).

For example, "compiler/commands/info.ss" contains

 (define rico
   '(("make" compiler/commands/make "compile source to bytecode" 100)
     ("exe" compiler/commands/exe "create executable" 20)
     ("pack" compiler/commands/pack "pack .... into a .plt archive" 10)
     ("decompile" compiler/commands/decompile "decompile bytecode" #f)
     ("expand" compiler/commands/expand "macro-expand source" #f)
     ("distribute" compiler/commands/exe-dir "prepare .... distribution" #f)
     ("c-ext" compiler/commands/c-ext "compile ... C-based extensions" #f)))

so that only "make", "exe", and "pack" show up in the list of
frequently used commands, and in that order.

The `rico/command-name' library provides a `short-program+command-name'
function whose result is a suitable program program name to give to
`command-line'. For example, the implementation of the "decompile"
command includes

 (define source-files
    #:program (short-program+command-name)
    #:args source-or-bytecode-file

so that `rico decompile --help' prints

 rico decompile [ <option> ... ] [<source-or-bytecode-file>] ...
 where <option> is one of
  --help, -h : Show this help
  -- : Do not treat any remaining argument as a switch (at this level)
 Multiple single-letter switches can be combined after one `-'; for
  example: `-h-' is the same as `-h --'

Posted on the dev mailing list.