[Ruby] tools for building a "smart" command-line language

Scott Laird scott at sigkill.org
Mon Aug 28 13:56:46 PDT 2006


I'm looking for a set of Ruby tools that probably don't exist.  If
they do, I've never been able to find them.

I'd like to write a tool that has a command-line langauge similar to
Cisco IOS.  This would include:
 - context-sensitive command-completion
 - context-sensitive help
 - ability to parse a simple language and turn it into an AST
 - ability to turn an AST back into source code
 - some ability to do blocks.  IOS has structures like this:

interface FastEthernet0/0
  ip address 1.2.3.4
  ...
end

The 'interface' command starts a new block; inside that block a
different set of grammar rules applies.

 - finally, you should be able to extend the grammar via plugins.  In
a Rails context, new code in vendor/plugins would be able to add new
commands to the language without patching the One Big Grammar File.

Has anyone seen any Ruby tools that can do *any* of this?  If not,
I'll probably have to write them.  Eventually.


Scott


More information about the Ruby mailing list