command line command structure representation 
Author Message
 command line command structure representation

I'm doing a command line interface in python.
I'm going to make extensive use of the completer and readline libraries
for line editing.
In order to intelligently complete commands at any point, I need to
represent the command heirarchy tree with all available options,
arguments, etc in python.
Is there anything out there (besides rapid logic's CLI package) to aid
in this task?

I've derived my own class from rlcompleter which looks for a list of my
commands and intercepts the completion key (tab) if one is detected.
Each command has syntax like this

add widget <name> [[not]opt1 xxx] [[not]opt2 yyy] [[not]flag1]

So my command tree representation will have to mark field types as:
- base command name, eg: add, delete, modify...
- non-promptable user entered string/number ie: no completion possible
- string/number from predefined list, completer cycles through these
- string/number from dynamically constructed list, completer options
built on demand.
- optional negation prefix, ie: not or no etc.

I know it's not that difficult to just create a set of nested structures
for this, but I'm trying to make something that is easily
extensible/maintanable, perhaps a way of embedding the command structure
tree in the command implementation classes themselves, and building it
at runtime though introspection.
Or, some kind of tree editor?

Any thoughts or suggestions?

Thanks, Bruce.

Mon, 18 Aug 2003 23:35:26 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Win2000 Gawk Renaming a file with system() command, command line to long

2. command environments and command line arguments

3. Command line variables to executables,command programs

4. command line options for old viscob and vclink commands

5. Fortran command to read command line argument?

6. System commands and command-line args with g77 on Sun

7. Obtaining the line reached in a source command without terminating the command

8. reading a line and executing a command on that line

9. Tcl command structure

10. Stepping through Tcl control structure commands

11. Newbie: Ugly looking command processor commands

12. Command Table Help - trying to define alternate command for SCRNAME


Powered by phpBB® Forum Software