Skip to content

Commit

Permalink
Merge pull request #70 from jack1142/fix_warning
Browse files Browse the repository at this point in the history
Fix warning when mixing positional args and options
  • Loading branch information
sbrunner authored Mar 19, 2021
2 parents 2dbc18c + 5c678a3 commit d2b2920
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sphinx-prompt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import BashLexer, BatchLexer, PowerShellLexer, PythonLexer, ScalaLexer, TextLexer
from sphinx.util import logging

logger = logging.getLogger(__name__)


class PromptCache:
Expand Down Expand Up @@ -74,9 +77,11 @@ def run(self):
for idx, option_name in enumerate(("language", "prompts", "modifiers")):
if arg_count > idx:
if self.options.get(option_name):
self.warning(
"{0} is already passed as an option, ignoring the value passed"
" as positional argument and all arguments that come after it.".format(option_name)
logger.warning(
"%s is already passed as an option, ignoring the value passed"
" as positional argument and all arguments that come after it.",
option_name,
location=(self.state.document.settings.env.docname, self.lineno),
)
break
else:
Expand Down

0 comments on commit d2b2920

Please sign in to comment.