SourceForge

CLISH (Command Line Interface SHell)

Downloads | Documentation | XML schema | Example XML file | Screenshot

Overview

A modular framework for implementing a CISCO-like CLI on a *NIX system. Arbitary command menus and actions can be defined using XML files. This software handles the user interaction, and forks the appropriate system commands to perform any actions.

Key Design Points

Running the shell

When the "clish" shell is launched it searches the directories held in the CLISH_PATH environment variable (or "/etc/clish:~/.clish" by default) for any files with a ".xml" extension. All such files are read and used to build up the CLI tree for the current user.

Access is controlled by optionally defining the usergroup to which a command belongs. Only commands which have no-access controls or belong to any group of which the current user is a member will be loaded into memory. This means that the content of the CLI menus can be made to change based on who is running the shell.

Once all the XML has been loaded the <STARTUP> tag will be actioned as follows:-

The shell will guide the user through the available commands, and will provide context sensitive help and auto-completion. When a command is finally entered it spawns a sub-shell to interpret the instructions defined in a command's <ACTION> tag.

CLISH will not allow a user to enter a syntatically incorrect command line. If a mistake is made then some context sensitive help will be provided, to try and clarify what it wrong, and the terminal bell (CTRL-G) will be rung.

Downloads

clish-0.7.3-toolkit.tar.gz This is a pre-compiled binary package for Cygwin
clish-0.7.3.tar.gz This is the source tarball.

Documentation

clish-0.7.3

XML Schema

The XML syntax understood by CLISH is defined by XMLSchema/clish.xsd. If you wish to validate any XML against this schema then try putting the following at the top of your XML files.
<?xml version="1.0" encoding="UTF-8"?>
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
                     http://clish.sourceforge.net/XMLSchema/clish.xsd">

Example XML file

The following XML file defined some time configuration related commands. The screenshot below shows some of the CLI associated with this file.
<?xml version="1.0" encoding="UTF-8"?>
<CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
                     http://clish.sourceforge.net/XMLSchema/clish.xsd">

    <!--=======================================================-->
    <PTYPE name="TIME_HHMMSS"
        pattern="(([0-1][0-9]|[2][0-3]):[0-5][0-9]:[0-5][0-9])"
          help="HH:MM:SS using 24 hour clock"/>
    <!--=======================================================-->
    <PTYPE name="TZ_OFFSET_HR"
         method="integer"
        pattern="-12..12"
           help="Time offset from UTC"/>
       <!--=======================================================-->
       <PTYPE name="DAY_MONTH"
            method="integer"
           pattern="0..31"
              help="Calendar day of month"/>
       <!--=======================================================-->
       <PTYPE name="MONTH_NAME"
            method="select"
           pattern="January(1) February(2) March(3) April(4) May(5) June(6) July(7) August(8) September(9) October(10) November(11) December(12)"
              help="Month of the year"/>
       <!--=======================================================-->
       <PTYPE name="TZ_NAME"
            method="select"
           pattern="GMT(GreenwichMeanTime) PST(PacificStandardTime) EST(EasternStandardTime)"
              help="Timezone Name" />
       <!--=======================================================-->
       <PTYPE name="YYYY_YEAR"
            method="integer"
           pattern="1993..2035"
              help="Year"/>
    <!--=======================================================-->
   <COMMAND name="clock"
            help="some utility commands for time related details"/>
   <!--=======================================================-->
   <COMMAND name="clock set"
            help="Set the time and date">
       <PARAM name="time"
              help="Current time"
              ptype="TIME_HHMMSS"/>
       <PARAM name="day"
              help="Day of the month"
              ptype="DAY_MONTH"/>
       <PARAM name="month"
              help="Month of year"
              ptype="MONTH_NAME"/>
       <PARAM name="year"
              help="Year"
              ptype="YYYY_YEAR"/>
       <ACTION>echo SET-TIME time:${time} day:${day} month:${month} year:${year}</ACTION>
   </COMMAND>
   <!--=======================================================-->
   <COMMAND name="clock timezone"
            help="Set the timezone">
        <PARAM name="zone"
               help="The time zone"
              ptype="TZ_NAME"/>
        <PARAM name="hours"
               help="The offset from the UTC"
               ptype="TZ_OFFSET_HR"/>
       <ACTION>echo TIMEZONE zone: ${zone} hours:${hours}</ACTION>
   </COMMAND>
   <!--=======================================================-->    
</CLISH_MODULE>

Screenshot

CLISH screenshot