datalad getexec

Synopsis

datalad getexec [-h] [-O PATH] [-d PATH] [-i PATH] [-m MESSAGE] [--version] COMMAND [COMMAND ...]

Description

Get a file by executing a command and register the command for future retrievals

The command consists of a list of strings which are passed as is to python's "subprocess.run". No shell interpretation takes place, if you want that you need to execute a shell yourself. In the invocation a last argument naming the output file the command should write to is added. Therefore your command should expect a single argument which specifies it's output path.

Examples

Run an executable script and register it for an output file:

% datalad getexec --path output.txt 'code/script.sh'

Use bash and specify the full command:

% datalad getexec --path test.txt -- 'bash' '-c' 'printf "Hello World!" > "$1"' 'test-cmd'

Run an executable script which depends on other files and register it for an output file:

% datalad getexec --path output.txt --input input1.txt -i input2.txt -- 'code/script.sh' input1.txt input2.txt

Options

COMMAND

the command to execute and register. The first argument is the program to execute, the following arguments are passed to this program. It is expected that the program takes a target filename as its last argument, which is appended to the full command in the special remote. Constraints: value must be a string

-h, --help, --help-np

show this help message. --help-np forcefully disables the use of a pager for displaying the help message

-O PATH, --path PATH

target for the program execution. If the path is directory, then a string representation of the command will be used as the target filename. Otherwise this parameter is assumed to be the target filename. The target is always assumed to be relative to the dataset. Constraints: value must be a string

-d PATH, --dataset PATH

specify the dataset to execute and register the command in. If no dataset is given, an attempt is made to identify the dataset based on the current working directory. The newly created file will be saved in the dataset. Constraints: Value must be a Dataset or a valid identifier of a Dataset (e.g. a path) or value must be NONE

-i PATH, --input PATH

a dependency for the getexec command. These dependencies will be fetched by a datalad get before executing the getexec command. The dependencies will be registered in git-annex in a way that they will be fetched on subsequent gets on the file created by getexec.

-m MESSAGE, --message MESSAGE

commit message to use. If no commit message is given the specified command will be used in a readable format. Constraints: value must be a string or value must be NONE

--version

show the module and its version which provides the command

Authors

datalad is developed by Matthias Riße <m.risse@fz-juelich.de>.