16.2 Declaring actions and action sets

The structure of the action sets tree is stored in global variables defined by default; we should never try to access such variables directly.

Function: mbfl_declare_action_set ACTION-SET

Declare a new action set. ACTION-SET must be a string satisfying mbfl_string_is_name() and representing the identifier of the action set. It is an error to declare the same action set twice.

Function: mbfl_declare_action ACTION-SET KEYWORD SUBSET IDENTIFIER DESCRIPTION

Declare a new action belonging to an action set. The arguments are:

action-set

A string representing the name of the action set this action belongs to. The action set must have been previously declared with a call to mbfl_declare_action_set().

keyword

A unique string (in this script) satisfying mbfl_string_is_name() and identifying this action. The “main”, “before parsing options” and “after parsing options” function names associated to this action are built as:

script_action_$KEYWORD
script_before_parsing_options_$KEYWORD
script_after_parsing_options_$KEYWORD
subset

If SUBSET is the string NONE it means that this action is a leaf and it implements a script action; else SUBSET must be the identifier of an action set subordinate to ACTION-SET: this function is recursively called to process it. The subordinate action set must have been previously declared with a call to mbfl_declare_action_set().

identifier

A string satisfying mbfl_string_is_identifier() and representing the argument on the command line used to select this action. This string must be unique for this ACTION-SET.

description

A string describing this action, to be used to compose the help screen.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.