Multiple argments in procedures
William-N-Havard opened this issue · comments
What is the problem?
The handbook (see here) states the following:
Procedures can implement any argument handling, but must be capable of taking at least one positional argument
This is however not true.
What steps will reproduce the problem?
Let's set up a dummy procedure that only prints the arguments that are given
if __name__ == '__main__':
import sys
print(sys.argv)
When running this procedure, we are left with an error
datalad create -c dummy dummy_dataset my_other_arg
CommandError: 'git -c diff.ignoreSubmodules=none -c core.quotepath=false for-each-ref '--format=%(refname:strip=2)' refs/heads refs/remotes' failed with exitcode 128
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
DataLad information
version: 0.19.3
Additional context
No response
Have you had any success using DataLad before?
Quite a lot!
Thanks for pointing this out! I'll see that I refine the wording. If I may ask, what kind of procedure do you want to implement?
Ideally, I'd like to implement a procedure similar to that of LAAC-LSCP's that would download a template from GitHub/GIN but without hardcoding the value as it is now done.
Something like:
datalad create -c from-github my_dataset --template LAAC-LSCP/el1000-template
It would be more generic than creating one procedure per dataset template as it is now the case
if you would like a quick way to get you going -- implement your procedure so it takes --options
and allows for their specification via env variables. Positional arguments of create
are passed to git init
(it is described in INIT OPTIONS
but --help
shows only ...
in their place in summary I guess due to length :-( ). As such we ATM do not have a mechanism to pass additional options besides location of dataset to a configuration procedure.
you can checkout how to create quickly such interfaces with click where you make option to take default from env var https://click.palletsprojects.com/en/8.1.x/options/#dynamic-defaults-for-prompts . Then just pass desired options to your cfg_ procedure this way