Skip to content
Merged
Changes from all 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
20 changes: 14 additions & 6 deletions pdoc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""pdoc's CLI interface and helper functions."""

import argparse
import ast
import importlib
import inspect
import os
Expand Down Expand Up @@ -370,12 +371,19 @@ def main(_args=None):
_warn_deprecated('--overwrite', '--force')
args.force = args.overwrite

try:
template_config = {opt.split('=', 1)[0]: eval(opt.split('=', 1)[1], {})
for opt in args.config}
except Exception as e:
raise RuntimeError('Error evaluating config values {}: {}\n'
'Make sure string values are quoted?'.format(args.config, e))
template_config = {}
for config_str in args.config:
try:
key, value = config_str.split('=', 1)
value = ast.literal_eval(value)
template_config[key] = value
except Exception:
raise ValueError(
'Error evaluating --config statement "{}". '
'Make sure string values are quoted?'
.format(config_str)
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switches error message to being for the single bad config option to hopefully be more specific.


if args.html_no_source:
_warn_deprecated('--html-no-source', '-c show_source_code=False', True)
template_config['show_source_code'] = False
Expand Down