17.4.1 Declaring command–line options

Every declared option should have a long switch, the brief switch can be omitted.

Function: mbfl_declare_option KEYWORD DEFAULT BRIEF LONG HASARG DESCRIPTION

Declare a new option. Arguments description follows.

KEYWORD

A string identifying the option; internally it is used to build a function name and a variable name. It is safer to limit this string to the letters in the ranges a-z, A-Z and underscores.

DEFAULT

The default value for the option. For an option with argument it can be anything; for an option with no argument: it must be yes or no.

BRIEF

The brief option selector: a single character. It is safer to choose a single letter (lower or upper case) in the ASCII standard. This argument can be the empty string if this option has no brief selector.

LONG

The long option selector: a string. It is safer to choose a sequence of letters in the ASCII standard, separated by underscores or dashes. This argument can be the empty string if this option has no long selector.

HASARG

Either witharg or noarg: declares if the option requires an argument or not.

DESCRIPTION

A one–line string briefly describing the option. This string will be printed with printf() using the %b format directive, which will cause the expansion of some backslash escpe sequences in DESCRIPTION.


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