Framework
DocCCommandLine
Build custom documentation workflows by leveraging the DocC compiler pipeline.
Overview
DocCCommandLine provides a default, command-line workflow for DocC, powered by Swift Argument Parser
. docc
commands, such as convert
and preview
, are conformant Action
types that use DocC to perform documentation tasks.
Use DocCCommandLine to build a custom, command-line interface and extend it with additional commands. To add a new sub-command called example
, create a conformant Action
type, ExampleAction
, that performs the desired work, and add it as a sub-command. Optionally, you can also reuse any of the provided actions like
ConvertAction
.
public import ArgumentParser
public struct MyDocumentationTool: AsyncParsableCommand {
public static var configuration = CommandConfiguration(
abstract: "My custom documentation tool",
subcommands: [ConvertAction.self, ExampleAction.self]
)
public init() {
}
}
MyDocumentationTool.main()
Adding a new sub-command automatically adds routing and execution of its code, adds its description to the command-line help menu, and ensures validation for its expected arguments.
Topics
Compiler Workflow
-
struct Docc
The default, command-line interface you use to compile and preview documentation.
-
struct ConvertAction
An action that converts a collection of documentation inputs into compiled documentation.
-
class PreviewAction
An action that monitors a documentation catalog for changes and runs a live web-preview.
-
struct IndexAction
An action that creates an index of a collection of documentation inputs.
-
struct InitAction
An action that generates a documentation catalog from a template seed.
Actions Design
Execution Workflow
Protocols
Structures
Enumerations
Extended Modules