Skip to content

Commit

Permalink
Add --host option to PreviewOptions
Browse files Browse the repository at this point in the history
This retains the `localhost` default host name for the preview server,
but allows the user to override it by providing `--host`.
  • Loading branch information
tomstuart committed Sep 25, 2023
1 parent b86a4b8 commit 5aa0556
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension PreviewAction {
{
// Initialize the `PreviewAction` from the options provided by the `Preview` command
try self.init(
host: "localhost",
host: previewOptions.host,
port: previewOptions.port,
createConvertAction: {
try ConvertAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import Foundation
public struct PreviewOptions: ParsableArguments {
public init() { }

@Option(
name: .shortAndLong,
help: ArgumentHelp(
"Host name to use for the preview web server.",
valueName: "host-name"))
public var host: String = "localhost"

/// The port number to use for the preview web server.
///
/// Defaults to `8080`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ extension Docc {
public static var configuration = CommandConfiguration(
abstract: "Convert documentation inputs and preview the documentation output.",
usage: """
docc preview [<catalog-path>] [--port <port-number>] [--additional-symbol-graph-dir <symbol-graph-dir>]
docc preview [<catalog-path>] [--port <port-number>] [--additional-symbol-graph-dir <symbol-graph-dir>] [--output-dir <output-dir>]
docc preview [<catalog-path>] [--port <port-number>] [--additional-symbol-graph-dir <symbol-graph-dir>] [--output-dir <output-dir>] [<availability-options>] [<diagnostic-options>] [<source-repository-options>] [<hosting-options>] [<info-plist-fallbacks>] [<feature-flags>] [<other-options>]
docc preview [<catalog-path>] [--host <host-name>] [--port <port-number>] [--additional-symbol-graph-dir <symbol-graph-dir>]
docc preview [<catalog-path>] [--host <host-name>] [--port <port-number>] [--additional-symbol-graph-dir <symbol-graph-dir>] [--output-dir <output-dir>]
docc preview [<catalog-path>] [--host <host-name>] [--port <port-number>] [--additional-symbol-graph-dir <symbol-graph-dir>] [--output-dir <output-dir>] [<availability-options>] [<diagnostic-options>] [<source-repository-options>] [<hosting-options>] [<info-plist-fallbacks>] [<feature-flags>] [<other-options>]
""",
discussion: """
The 'preview' command extends the 'convert' command by running a preview server and monitoring the documentation input for modifications to rebuild the documentation.
Expand Down

0 comments on commit 5aa0556

Please sign in to comment.