Skip to content

Commit

Permalink
Require --include-file-pattern to avoid the trap of trying to generat…
Browse files Browse the repository at this point in the history
…e for std
  • Loading branch information
danakj committed Sep 12, 2023
1 parent d76f542 commit 3c3ad5f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions subdoc/subdoc_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main(int argc, const char** argv) {
llvm::cl::desc(
"A path pattern for which documentation should be included in the "
"generated HTML. May be specified multiple times for multiple "
"patterns."),
"patterns. This is required."),
llvm::cl::cat(option_category));

llvm::cl::list<std::string> option_exclude_paths(
Expand Down Expand Up @@ -173,9 +173,17 @@ int main(int argc, const char** argv) {
return std::regex(sus::move(s).str());
};

if (option_include_paths.empty()) {
fmt::println(
stderr,
"Error: Missing --include-file-pattern. Without this, subdoc would "
"generate docs for every library used from the source files. "
"Specify which path pattern(s) to generate docs for.");
return 1;
}

auto run_options = subdoc::RunOptions();
if (!option_include_paths.empty())
run_options.include_path_patterns = paths_to_regex(option_include_paths);
run_options.include_path_patterns = paths_to_regex(option_include_paths);
if (!option_exclude_paths.empty())
run_options.exclude_path_patterns = paths_to_regex(option_exclude_paths);
if (option_project_md.getNumOccurrences() > 0) {
Expand Down

0 comments on commit 3c3ad5f

Please sign in to comment.