By Forrest Cook
April 9, 2008
The Cursed Menu
project implements a terminal-based menu system via the the
Curses terminal control library:
Cursed Menu aims to create an ncurses based menu system for character based sessions. This menu program could be used to create user, system administration, or utility menus for clients connecting with text based clients such as telnet, ssh, or rlogin.
Version 1.0.3 of Cursed Menu was recently
announced. Despite being unable to find any documentation whatsoever
on the project page, your editor decided to try out the software.
The code was
downloaded as a tar.bz2 file, uncompressed and untared.
The configure script was run on a system running Ubuntu 7.04.
There was one dependency issue that was fairly easily solved by
installing the libncurses5-dev package. After fixing that, the
software configured and made correctly.
The next logical action was to take a look at
the source code in the src/ subdirectory. The source files were mostly
.cc and .hh indicating a C++ project. The cursedmenu binary was run and
a blue curses screen similar to the example
screenshot showed up. Navigating through the menus was simply
a matter of using the arrow keys for movement and the Enter key for
selecting an item. A longer description of the item under the cursor
showed up on the lower left corner of the terminal screen.
A little more digging through the code revealed the configuration
system for Cursed Menu. Each menu has an associated .cmd file,
here's what the default main menu .cmd file looks like:
# default.cmd - The default Cursed Menu definition file
#
# Lines beginning with a pound sign (#) are comments.
# --------------------------------------------------------
#
debug = yes;
pause_after_execution = no;
# Each menu file contain one "MainMenu" which is the
# first menu displayed.
# ---------------------------------------------------
MenuBegin MainMenu
MenuTitle=Default Menu
MenuFore=white
MenuBack=blue
ItemName=Item #1
ItemDesc=This is a very nice 1st item
ItemExec=echo "Item #1"; sleep 5
ItemEnd
ItemName=Item #2
ItemDesc=This is a very nice 2nd item
ItemExec=echo "Item #2"; sleep 5
ItemEnd
ItemName=Sub Menu
ItemDesc=Go to the Sub Menu
ItemExec=MenuSub sub.cmd
ItemEnd
ItemName=Exit
ItemDesc=Exit this menu
ItemExec=MenuExit
ItemEnd
MenuEnd MainMenu
Customizing the .cmd file was fairly intuitive, shell commands
were added to the ItemExec lines and ran when the menu item was
selected. The cursedmenu binary picked up the changes in the .cmd
file without recompilation.
Cursed Menu provides a quick and easy way to control simple shell
scripts and could be useful for many purposes.
The project could really benefit from some basic documentation,
A simple README file with a description of the available commands
would be a good start. Despite this lack, the code seems to
function nicely and can be put to use as-is.
(
Log in to post comments)