Serialized Command Line Reading
read_opt_value_from_line()
Public: Reads the value of a given option from a serialized command line.
$1 - Serialized command line (as stored in a process’s “cmdline” variable, typically received as an argument to an option definition function).
$2 - Option name whose value we want to obtain.
Examples:
local n=$(read_opt_value_from_line "${cmdline}" "-n")
The function prints the value of the option if it was given, or the “DEBASHER_OPT_NOT_FOUND” constant otherwise.
read_flag_from_line()
Public: Reads whether a given flag was provided in a serialized command line.
$1 - Serialized command line (as stored in a process’s “cmdline” variable, typically received as an argument to an option definition function).
$2 - Flag name to check for.
Examples:
if read_flag_from_line "${cmdline}" "-m"; then
The function returns 0 if the flag was given, 1 otherwise.