Skip to content

Commit

Permalink
Merge pull request #40 from ayasyrev:app_verbose
Browse files Browse the repository at this point in the history
add -verbose argument, shorts flag for dry-run
  • Loading branch information
ayasyrev authored Aug 8, 2024
2 parents 9cbf610 + b67d0e8 commit 793472a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/nbmetaclean/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,17 @@
help="Clean hidden notebooks.",
)
parser.add_argument(
"-D",
"--dry_run",
action="store_true",
help="perform a trial run, don't write results",
)
parser.add_argument(
"-V",
"--verbose",
action="store_true",
help="Print more info - cleaned notebooks.",
)


def process_mask(mask: Union[list[str], None]) -> Union[tuple[TupleStr, ...], None]:
Expand Down Expand Up @@ -106,6 +113,9 @@ def app() -> None:
)
if not cfg.silent:
print(f"cleaned nbs: {len(cleaned)}")
if cfg.verbose:
for nb in cleaned:
print("- ", nb)
if errors:
print(f"with errors: {len(errors)}")
for nb, exc in errors:
Expand Down
2 changes: 2 additions & 0 deletions src/nbmetaclean/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class CleanConfig:
mask_merge (bool): Merge masks. Add new mask to default.
If False - use new mask. Defaults to True.
dry_run (bool): perform a trial run, don't write results. Defaults to False.
verbose (bool): Print more info - cleaned notebooks. Defaults to False.
"""

clear_nb_metadata: bool = True
Expand All @@ -48,6 +49,7 @@ class CleanConfig:
cell_metadata_preserve_mask: Optional[tuple[TupleStr, ...]] = None
mask_merge: bool = True
dry_run: bool = False
verbose: bool = False


def filter_meta_mask(
Expand Down

0 comments on commit 793472a

Please sign in to comment.