Skip to content

Commit

Permalink
Add recursive flag for glob notebook search (#1785)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
paoloalba and pre-commit-ci[bot] committed Jun 8, 2022
1 parent 64df08c commit 054e181
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nbconvert/nbconvertapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ def _postprocessor_class_changed(self, change):
""",
).tag(config=True)
from_stdin = Bool(False, help="read a single notebook from stdin.").tag(config=True)
recursive_glob = Bool(
False, help="set the 'recursive' option for glob for searching wildcards."
).tag(config=True)

@catch_config_error
def initialize(self, argv=None):
Expand Down Expand Up @@ -385,8 +388,8 @@ def init_notebooks(self):

# Use glob to find matching filenames. Allow the user to convert
# notebooks without having to type the extension.
globbed_files = glob.glob(pattern)
globbed_files.extend(glob.glob(pattern + ".ipynb"))
globbed_files = glob.glob(pattern, recursive=self.recursive_glob)
globbed_files.extend(glob.glob(pattern + ".ipynb", recursive=self.recursive_glob))
if not globbed_files:
self.log.warning("pattern %r matched no files", pattern)

Expand Down

0 comments on commit 054e181

Please sign in to comment.