docs » hs.doc.spoonsupport

Provides run-time support for generating and including documentation for installed Hammerspoon Spoon bundles.

This module provides support for building (if necessary) and loading the documentation for installed Spoon bundles. In general, it is not expected that most users will have a need to access these functions directly.

API Overview

API Documentation

Functions

findSpoons
Signature hs.doc.spoonsupport.findSpoons() -> pathTable, spoonsTable
Type Function
Description

Returns tables describing where spoons are installed and what spoons are currently available.

Parameters:

  • None

Returns:

  • two tables:
    • an array containing the paths from package.path which can contain Hammerspoon Spoon bundles.
    • a table with key-value pairs where the key matches an installed (but not necessarily loaded) spoon name and the value is a table containing the following keys:
      • path - the path to the directory which contains the contents of the Spoon bundle
      • docPath - the expected path for documentation for this Spoon bundle
      • hasDocs - a boolean indicating whether or not the file referred to by docPath exists and is readable
makeDocsFile
Signature hs.doc.spoonsupport.makeDocsFile(spoonPath, [force]) -> none
Type Function
Description

Create the docs.json file for the Spoon bundle at the specified path.

Parameters:

  • spoonPath - the path of the Spoon bundle to generate the documentation for
  • force - an optional boolean, default false, indicating whether or not an existing docs.json file within the Spoon bundle should be overwritten.

Returns:

  • None
updateDocFiles
Signature hs.doc.spoonsupport.updateDocFiles() -> none
Type Function
Description

Creates and updates the included documentation for the installed Spoon bundles if the documentation file is not present or the init.lua file for the Spoon has been modified more recently then the documentation file.

Parameters:

  • None

Returns:

  • None

Notes:

  • The Spoon documentation is expected to be in a file named docs.json at the root level of the Spoon bundle.