Skip to content

Shdoc

Index

shdoc::file_has_description

Return true if the given script file carries an # @description shdoc tag in its file-level header — i.e. somewhere between the shebang line and either the first set -Eeuo pipefail line or, for standalone misc/ scripts that omit that pragma, within the first 30 lines.

Arguments

  • $1 (file): path to script

Exit codes

  • 0: if a # @description line is found in the header window
  • 1: otherwise

shdoc::find_unannotated_functions

Scan a script file for top-level helper function definitions of the form function NAME() { and print the names of any whose immediately preceding non-blank, non-shellcheck-directive line is NOT a shdoc tag line (does not match ^# @). The literal main function is always excluded — it is covered by the file-level header per project rule.

Arguments

  • $1 (file): path to script

Exit codes

  • 0: always (presence of unannotated functions is signaled via stdout)

Output on stdout

  • names of unannotated helper functions, one per line