package org.implab.gradle.common.tasks;

import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Internal;
import org.implab.gradle.common.dsl.TaskCommandSpecMixin;
import org.implab.gradle.common.exec.CommandSpec;
import org.implab.gradle.common.exec.Shell;
import org.implab.gradle.common.exec.ShellExec;

public abstract class ShellExecTask
        extends AbstractShellExecTask
        implements TaskCommandSpecMixin {

    @Internal
    public abstract Property<Shell> getShell();

    @Internal
    @Override
    public abstract ListProperty<String> getCommandLine();


    @Override
    protected ShellExec execBuilder() {
        return getShell().get()
                .of(CommandSpec.builder()
                        .commandLine(getCommandLine().get())
                        .build());
    }

}
