16.5.1 Application interface to completion script generation

Function: mbfl_actions_completion_print_script NAMESPACE PROGNAME
Function: mbfl_actions_completion_print_script NAMESPACE PROGNAME SCRIPT_TYPE

Print to the standard output a GNU Bash script, the completions–script, to be evaluated in a terminal running Bash, to implement automatic completion of the command line for a subject–script.

The argument NAMESPACE must be a string representing a namespace for function names; functions in the completions–script have names starting with this string.

The argument PROGNAME must be a string representing the name of the subject–script for which the completions–script is generated. It is usually the value of the service variable script_PROGNAME, script_PROGNAME for details.

The optional argument SCRIPT_TYPE selects the type of script to output:

main

Output the full completions–script for a subject–script; this is the default. When sourced: such completions–script will provide full completions for the subject–script. The completions–script is composed by a call to the Bash built–in complete followed by a number of functions.

subscript

Output only the completion functions for the actions of the subject–script; do not output a call to the Bash built–in complete. This completions–script type is meant to be used for subject–scripts that are not directly invoked by the user; rather they are subordinate scripts invoked by a main script: the actions of the subordinate script are “plugged” in the actions of the main script as a subtree.


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