Skip to content

Commit

Permalink
FEAT cli dir option
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgWa committed Oct 17, 2023
1 parent 3c08360 commit f52f8c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion alphadia/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import time
import yaml
import os

# alphadia imports
import alphadia
Expand Down Expand Up @@ -49,6 +50,12 @@ def gui():
multiple=True,
type=click.Path(exists=True, file_okay=True, dir_okay=True),
)
@click.option(
'--directory',
'-d',
help="Directory containing raw data input files.",
type=click.Path(exists=True, file_okay=False, dir_okay=True),
)
@click.option(
'--library',
'-l',
Expand Down Expand Up @@ -130,9 +137,12 @@ def extract(**kwargs):
files = None
if kwargs['file'] is not None:
files = list(kwargs['file'])

if kwargs['directory'] is not None:
files += [os.path.join(kwargs['directory'], f) for f in os.listdir(kwargs['directory'])]

if "files" in config_update:
files = config_update['files'] if type(config_update['files']) is list else [config_update['files']]
files += config_update['files'] if type(config_update['files']) is list else [config_update['files']]

if (files is None) or (len(files) == 0):
logging.error("No files specified.")
Expand Down

0 comments on commit f52f8c7

Please sign in to comment.