Skip to content

Commit fbad8c7

Browse files
committed
rimport: Improve help (no longer needs relpaths).
1 parent f19beb5 commit fbad8c7

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

rimport

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def build_parser() -> argparse.ArgumentParser:
4545
argparse.ArgumentParser: Configured parser ready to parse command-line arguments.
4646
"""
4747
parser = argparse.ArgumentParser(
48-
description="Copy files from CESM inputdata directory to a publishing directory.",
48+
description=(
49+
f"Copy files from CESM inputdata directory ({DEFAULT_INPUTDATA_ROOT}) to a publishing"
50+
" directory."
51+
),
4952
add_help=False, # Disable automatic help to add custom -help flag
5053
)
5154

@@ -56,7 +59,7 @@ def build_parser() -> argparse.ArgumentParser:
5659
"-file",
5760
dest="file",
5861
metavar="filename",
59-
help="Provide a single filename relative to the top inputdata directory",
62+
help="Provide a file to import. Must be in the CESM inputdata directory.",
6063
)
6164
group.add_argument(
6265
"--list",
@@ -65,7 +68,7 @@ def build_parser() -> argparse.ArgumentParser:
6568
metavar="filelist",
6669
help=(
6770
"Provide a file that contains a list of filenames to import. All filenames in the list"
68-
"are relative to the top inputdata area."
71+
" must be in the CESM inputdata directory."
6972
),
7073
)
7174

@@ -343,21 +346,21 @@ def main(argv: List[str] | None = None) -> int:
343346
logger.error("rimport: inputdata directory does not exist: %s", root)
344347
return 2
345348

346-
# Determine the list of relative filenames to handle
349+
# Determine the list of filenames to handle
347350
if args.file is not None:
348-
relnames = [args.file]
351+
files_to_process = [args.file]
349352
else:
350353
list_path = Path(args.filelist).expanduser().resolve()
351354
if not list_path.exists():
352355
logger.error("rimport: list file not found: %s", list_path)
353356
return 2
354-
relnames = read_filelist(list_path)
355-
if not relnames:
357+
files_to_process = read_filelist(list_path)
358+
if not files_to_process:
356359
logger.error("rimport: no filenames found in list: %s", list_path)
357360
return 2
358361

359362
# Resolve to full paths (keep accepting absolute names too)
360-
paths = normalize_paths(root, relnames)
363+
paths = normalize_paths(root, files_to_process)
361364
staging_root = get_staging_root()
362365
# Execute the new action per file
363366
errors = 0

0 commit comments

Comments
 (0)