package org.implab.gradle.common.dsl;

import java.util.stream.Stream;

import org.gradle.api.provider.ListProperty;
import org.implab.gradle.common.utils.Properties;

public interface TaskCommandSpecMixin {
    ListProperty<String> getCommandLine();

    default void commandLine(Object arg0, Object... args) {
        getCommandLine().empty();
        Properties.mergeList(
                getCommandLine(),
                () -> Stream.concat(Stream.of(arg0), Stream.of(args)).iterator(),
                Object::toString);
    }

    default void args(Object arg0, Object... args) {
        Properties.mergeList(
                getCommandLine(),
                () -> Stream.concat(Stream.of(arg0), Stream.of(args)).iterator(),
                Object::toString);
    }

}
