FNNDSC / FNNDSC/chrisapp

Experiment with building a sensible PathMapper.file_mapper default directly into the decorator

Open
#19 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I think the simplest possible plugin shouldn't need to include this detail, instead having sensible defaults.

i.e.
```py
@chris_plugin(
parser=parser,
)
def main(options: Namespace, inputdir: Path, outputdir: Path):
"""
mapper = PathMapper.file_mapper(inputdir, outputdir, glob="*")
for input_file, output_file in mapper:
pass
```

Should be achievable with just this:
```py
@chris_plugin(
parser=parser,
)
def main(options: Namespace, inputdir: Path, outputdir: Path):
"""
for input_file in os.listdir(inputdir)
pass
```

i.e. treat the paths given as if it was a simple linux script. Or:
- have `main` take the input_file and output_file one at a time, and repeatly call the function
- have `main` take mapper directly as an arg.

I am unsure which I prefer. I would lean towards main taking mapper directly as an arg, which would better self-describe how it is meant to work. I think inputdir and outputdir at present are misleading slightly.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.