mirror of
https://github.com/DarrylNixon/melamine.git
synced 2024-04-22 06:27:20 -07:00
Move FS discovery into new class coros
This commit is contained in:
parent
ef7b1b95f6
commit
d8b3fb7f17
2 changed files with 17 additions and 19 deletions
|
@ -1,11 +1,12 @@
|
|||
import argparse
|
||||
|
||||
from .classes import get_all_hardlinks
|
||||
from .classes import ShredDir
|
||||
from .classes import ShredFile
|
||||
from .fileops import mount_to_fs_handler
|
||||
from .logs import logger
|
||||
|
||||
|
||||
async def main(job) -> bool:
|
||||
async def main(job: argparse.Namespace) -> bool:
|
||||
"""
|
||||
This is the main function for processing a shred request.
|
||||
It is called by the CLI and builds a job queue based on the arguments passed.
|
||||
|
@ -17,15 +18,11 @@ async def main(job) -> bool:
|
|||
for path in job.paths:
|
||||
if path.is_file():
|
||||
logger.info(f"Adding file: {path}")
|
||||
shred_file = ShredFile(path)
|
||||
shred_file.fs_handler = await mount_to_fs_handler(shred_file.mount_point)
|
||||
new_paths.add(shred_file)
|
||||
new_paths.add(await ShredFile(path))
|
||||
elif path.is_dir():
|
||||
if job.recursive:
|
||||
logger.info(f"Adding directory: {path}")
|
||||
shred_dir = ShredDir(path)
|
||||
shred_dir.fs_handler = await mount_to_fs_handler(shred_dir.mount_point)
|
||||
new_paths.add(shred_dir)
|
||||
new_paths.add(await ShredDir(path))
|
||||
else:
|
||||
logger.info(f"Skipping directory: {path} (try -r/--recursive)")
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue