Prompt

Collection of functions for tasks.

GetTaskID

Returns the identifier (name) of a task for a given input string.

Arguments Return (print)

$1: the input string to test for a task identifier

Success: long form of the task

Error: empty string

id=$(GetTaskID "string")

BuildTaskHelpLine

Prints a single line for the task help screen with one argument and its settings. An argument is described by:

  • a short form, use <none> if not applicable

  • a long form, use <none> if not applicable

  • an argument, use <none> if not applicable, if used the string will be converted to upper case spelling

  • a description in form of a short tag line

Additionally, a length value an be given. The length is used to calculate the padding between short/long/argument and description. The padding default value is 24.

Arguments Return

$1: short options

$2: long option

$3: argument

$4: description

$5: length

none

BuildTaskHelpLine h help "<none>" "print help screen and exit" 25

BuildTaskHelpLine f file "FILE" "file to open in viewer" 25

TaskGetCachedHelp

Returns a file name with cached help screen for current print-mode, none if none found.

Arguments Return (print)

$1: task ID, long form

Success: file name

Error: empty string

CACHED_HELP=$(TaskGetCachedHelp "my-task")