Package gnu.dtools.ritopt
Class OptionMenu
- java.lang.Object
-
- gnu.dtools.ritopt.OptionMenu
-
- All Implemented Interfaces:
OptionListener
public class OptionMenu extends java.lang.Object implements OptionListener
This class facilitates the built-in menu feature for ritopt. When the --menu long option is invoked, an instance of this class is notified, and the menu system starts. Here is an example run of the built-in menu.-> ? - Options Delimiter ? Help = Run program and return to menu ! Shell to Operating System $ Exit menu + Additional options @<filename> Get options from file [default.opt] @@ Get options from file [default.opt] %<filename> Put options in file %% Put options in file [default.opt] . Quit -> =ls -> =uname CYGWIN_ME-4.90 Exit status: 0 Press enter to continue... -> =ls CVS Makefile Makefile.am Makefile.in edu gnu ritopt.jar Exit status: 0 Press enter to continue.. -> --help java FavoriteFood @optionfile [module] OPTIONS ... [module] OPTIONS Use --menu to invoke the interactive built-in menu. Option Name Type Description -h, --help <NOTIFY> Displays help for each option. -m, --menu <NOTIFY> Displays the built-in interactive menu. --fatfree <BOOLEAN> No description given -v, --version <NOTIFY> Displays version information. --name <STRING> No description given -g, --grub <STRING> Favorite Food -f, --food <STRING> Favorite Food -c, --food-coun <STRING> No description given -> --grub=tacos Warning: --grub or -g is deprecated. -> --grubb Error: Option --grubb does not exist in module 'General'. -> .
Copyright (C) Damian Ryan Eads, 2001. All Rights Reserved. ritopt is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ritopt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ritopt; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXIT_MENU_COMMAND_CHAR
This command exits the built-in menu system.static java.lang.String
FILE_MODULE_COMMAND_CHAR
Loads an option module.static java.lang.String
FILE_READ_COMMAND_CHAR
This command without any arguments loads the default option file.static java.lang.String
FILE_WRITE_COMMAND_CHAR
This command without any arguments writes to the default option file.static java.lang.String
HELP_COMMAND_CHAR
This command without any arguments displays the command summary.static java.lang.String
LIST_MODULES_COMMAND_CHAR
This command lists registered option modules.static java.lang.String
MENU_PROMPT
The menu prompt used for the built-in menu system.static java.lang.String
OPTION_COMMAND_CHAR
Commands starting with this substring are option invocations.static java.lang.String
RUN_COMMAND_CHAR
This command must have an argument.static java.lang.String
SHELL_COMMAND_CHAR
This command spawns a shell.
-
Constructor Summary
Constructors Constructor Description OptionMenu(Options options)
Constructs a new built-in menu attaching it to the options registrar passed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
optionInvoked(OptionEvent event)
This method is notified when the --menu option is specified.void
startMenu()
Starts the built-in menu system.
-
-
-
Field Detail
-
OPTION_COMMAND_CHAR
public static final java.lang.String OPTION_COMMAND_CHAR
Commands starting with this substring are option invocations.- See Also:
- Constant Field Values
-
HELP_COMMAND_CHAR
public static final java.lang.String HELP_COMMAND_CHAR
This command without any arguments displays the command summary. Otherwise, specific help information is provided based on the argument.- See Also:
- Constant Field Values
-
RUN_COMMAND_CHAR
public static final java.lang.String RUN_COMMAND_CHAR
This command must have an argument. When invoked, it executes the argument at the command shell.- See Also:
- Constant Field Values
-
SHELL_COMMAND_CHAR
public static final java.lang.String SHELL_COMMAND_CHAR
This command spawns a shell.- See Also:
- Constant Field Values
-
EXIT_MENU_COMMAND_CHAR
public static final java.lang.String EXIT_MENU_COMMAND_CHAR
This command exits the built-in menu system.- See Also:
- Constant Field Values
-
LIST_MODULES_COMMAND_CHAR
public static final java.lang.String LIST_MODULES_COMMAND_CHAR
This command lists registered option modules.- See Also:
- Constant Field Values
-
FILE_READ_COMMAND_CHAR
public static final java.lang.String FILE_READ_COMMAND_CHAR
This command without any arguments loads the default option file. Otherwise, the file as the argument is loaded.- See Also:
- Constant Field Values
-
FILE_WRITE_COMMAND_CHAR
public static final java.lang.String FILE_WRITE_COMMAND_CHAR
This command without any arguments writes to the default option file. Otherwise, the file as the argument is written.- See Also:
- Constant Field Values
-
FILE_MODULE_COMMAND_CHAR
public static final java.lang.String FILE_MODULE_COMMAND_CHAR
Loads an option module. Invoking this command without any arguments, the default option module is loaded.- See Also:
- Constant Field Values
-
MENU_PROMPT
public static final java.lang.String MENU_PROMPT
The menu prompt used for the built-in menu system.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OptionMenu
public OptionMenu(Options options)
Constructs a new built-in menu attaching it to the options registrar passed.- Parameters:
options
- The option registrar associated with this built-in menu.
-
-
Method Detail
-
startMenu
public void startMenu()
Starts the built-in menu system.
-
optionInvoked
public void optionInvoked(OptionEvent event)
This method is notified when the --menu option is specified.- Specified by:
optionInvoked
in interfaceOptionListener
- Parameters:
event
- The event associated.
-
-