Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify -o long option to be --store-dir #59

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ install:
for s in $STUDIES; do
for v in visit_a visit_b; do
icf-utils make_studyvisit_archive
--output-dir "$STUDIES_DIR"
--store-dir "$STUDIES_DIR"
--id $s $v
"$FROM_SCANNER";
done
Expand Down
24 changes: 20 additions & 4 deletions bin/make_studyvisit_archive
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ from datetime import datetime
from hashlib import md5
from pathlib import Path
from typing import Dict
import warnings

from tqdm import tqdm

Expand Down Expand Up @@ -178,11 +179,16 @@ def main(input_base_dir: str,
if __name__ == '__main__':
import argparse
p = argparse.ArgumentParser(description=__doc__)
p.add_argument(
"-o", "--output-dir", metavar='PATH', default=os.getcwd(),
g = p.add_mutually_exclusive_group()
g.add_argument(
"-o", "--store-dir", metavar='PATH', default=os.getcwd(),
help="Base directory to place the archive structure in. "
"The corresponding '<study-id>/' subdirectory for the "
"study is created automatically, if needed")
"study is created automatically, if needed.")
g.add_argument(
"--output-dir", metavar="PATH",
help="Deprecated, will be removed in the future; "
"use -o/--store-dir instead.")
p.add_argument(
'--id', nargs=2, metavar=('STUDY-ID', 'VISIT-ID'), required=True,
help="The study and visit identifiers, used to name and "
Expand All @@ -198,8 +204,18 @@ if __name__ == '__main__':
"directory with the name '<study-id>_<visit_id>' is used "
"to place all archive content in.")
args = p.parse_args()
if args.output_dir is not None:
store_dir = args.output_dir
msg = (
"--output-dir argument is deprecated and will be removed "
"in the future. Use -o/--store-dir instead."
)
warnings.warn(msg, DeprecationWarning)
else:
store_dir = args.store_dir

main(input_base_dir=args.input_dir,
output_base_dir=args.output_dir,
output_base_dir=store_dir,
study_id=args.id[0],
visit_id=args.id[1],
)
Loading