Skip to content

Commit fa5b188

Browse files
committed
switch nclist -> contents; make files click.Path
1 parent f02b9c4 commit fa5b188

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

paths_cli/commands/contents.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
from paths_cli.parameters import INPUT_FILE
33

44
@click.command(
5-
'nclist',
5+
'contents',
66
short_help="list named objects from an OPS .nc file",
77
)
88
@INPUT_FILE.clicked(required=True)
9-
def nclist(input_file):
9+
def contents(input_file):
1010
"""List the names of named objects in an OPS .nc file.
1111
1212
This is particularly useful when getting ready to use one of simulation
@@ -63,6 +63,6 @@ def get_section_string_nameable(section, store, get_named):
6363
+ _item_or_items(n_unnamed))
6464
return out_str
6565

66-
CLI = nclist
66+
CLI = contents
6767
SECTION = "Miscellaneous"
6868
REQUIRES_OPS = (1, 0)

paths_cli/parameters.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,15 @@ def init_snap_fallback(parameter, storage, name):
182182
)
183183

184184
INPUT_FILE = StorageLoader(
185-
param=Argument('input_file', type=str),
185+
param=Argument('input_file',
186+
type=click.Path(exists=True, readable=True)),
186187
mode='r'
187188
)
188189

189190
OUTPUT_FILE = StorageLoader(
190-
param=Option('-o', '--output-file', type=str, help="output ncfile"),
191+
param=Option('-o', '--output-file',
192+
type=click.Path(writable=True),
193+
help="output ncfile"),
191194
mode='w'
192195
)
193196

0 commit comments

Comments
 (0)