xml format for command line options

Bernhard Fastenrath bfastenrath@mac.com
Mon Apr 5 01:01:00 GMT 2004


I'd like to define an xml format for command line options.

The idea is to make command completion, search and description
of options as convenient and fast as possible.

If this format were common across all GNU command line tools
a shell could use a common way to retrieve this format
(e.g. an option like "--xml-help") to access a computer readable
format.
This would help to build graphical programs on top of command
line tools, allow for easy command  line completion in unix shells
and would make the retrieval of descriptions very convenient:

optgrep gcj *semi*
 -Wextraneous-semicolon
           This causes gcj to warn about empty statements.  Empty statements
           have been deprecated.

I guess this is not the best mailing list to suggest this but it happens to
be the only gcc mailing list I'm subscribed to and if gcc would offer
something like this chances are good it could become a standard.

What do you think?

format example:

<program name="gcj">
  <pattern name="#colon-separated-path">
      <file:dir|jar>[:<file:dir|jar>]*
  <pattern>
  <argument>
    <option param="-I">
    <description>
           All directories specified by "-I" are kept in order and prepended
           to the class path constructed from all the other options.  Unless
           compatibility with tools like "javac" is important, we recommend
           always using "-I" instead of the other options for 
manipulating the
           class path.
    </description>
  </argument>
  <argument>
     <option param="--main" value="CLASSNAME" required="true">
     <description>
           This option is used when linking to specify the name of the class
           whose "main" method should be invoked when the resulting 
executable
           is run.
     </description>
  </argument>
     <option param="--classpath" value="classpath" 
pattern="#colon-separated-path" required="true">
     <description>
           If --classpath is specified, its value is appended.  
Otherwise, if
           the "CLASSPATH" environment variable is specified, then its value
           is appended.  Otherwise, the current directory (""."") is 
appended.
     </description>
   ...
</program>



More information about the Java mailing list