Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Display a warning if an input directory does not exist. #242

Merged
merged 4 commits into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ $ apt-get install -y libxml2-dev graphviz
USAGE: swift doc generate [<inputs> ...] --module-name <module-name> [--output <output>] [--format <format>] [--base-url <base-url>]

ARGUMENTS:
<inputs> One or more paths to Swift files
<inputs> One or more paths to a directory containing Swift files.

OPTIONS:
-n, --module-name <module-name>
Expand Down Expand Up @@ -150,7 +150,7 @@ pass the `--minimum-access-level` flag with the specified access level.
USAGE: swift doc coverage [<inputs> ...] [--output <output>]

ARGUMENTS:
<inputs> One or more paths to Swift files
<inputs> One or more paths to a directory containing Swift files.

OPTIONS:
-o, --output <output> The path for generated report
Expand Down Expand Up @@ -202,7 +202,7 @@ please reach out by [opening an Issue][open an issue]!
USAGE: swift doc diagram [<inputs> ...]

ARGUMENTS:
<inputs> One or more paths to Swift files
<inputs> One or more paths to a directory containing Swift files.

OPTIONS:
--minimum-access-level <minimum-access-level>
Expand Down
2 changes: 1 addition & 1 deletion Sources/swift-doc/Subcommands/Coverage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SwiftDoc
extension SwiftDoc {
struct Coverage: ParsableCommand {
struct Options: ParsableArguments {
@Argument(help: "One or more paths to Swift files")
@Argument(help: "One or more paths to a directory containing Swift files.")
var inputs: [String]

@Option(name: .shortAndLong,
Expand Down
2 changes: 1 addition & 1 deletion Sources/swift-doc/Subcommands/Diagram.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import GraphViz
extension SwiftDoc {
struct Diagram: ParsableCommand {
struct Options: ParsableArguments {
@Argument(help: "One or more paths to Swift files")
@Argument(help: "One or more paths to a directory containing Swift files.")
var inputs: [String]

@Option(name: .long,
Expand Down
11 changes: 10 additions & 1 deletion Sources/swift-doc/Subcommands/Generate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension SwiftDoc {
}

struct Options: ParsableArguments {
@Argument(help: "One or more paths to Swift files")
@Argument(help: "One or more paths to a directory containing Swift files.")
var inputs: [String]

@Option(name: [.long, .customShort("n")],
Expand Down Expand Up @@ -47,6 +47,15 @@ extension SwiftDoc {
var options: Options

func run() throws {
for directory in options.inputs {
var isDirectory: ObjCBool = false
if !FileManager.default.fileExists(atPath: directory, isDirectory: &isDirectory) {
logger.warning("Input directory \(directory) does not exist.")
} else if !isDirectory.boolValue {
logger.warning("Input path \(directory) is not a directory.")
}
}

let module = try Module(name: options.moduleName, paths: options.inputs)
let baseURL = options.baseURL

Expand Down