package com.atlassian.bitbucket.mesh.git.hook.script;

import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;

import static java.util.Objects.requireNonNull;

/**
 * A {@link HookScriptCommandLineFactory} for POSIX-like environments, like Linux and macOS, which executes hook
 * scripts directly, without needing to launch them via an interpreter.
 * <p>
 * Note that scripts may use {@code #!} (shebang) directives to use a specific interpreter, like Perl or Python,
 * but that's orthogonal to the command line used to execute the script.
 */
public class PosixHookScriptCommandLineFactory implements HookScriptCommandLineFactory {

    @Nonnull
    @Override
    public List<String> create(@Nonnull String script) {
        return Collections.singletonList(requireNonNull(script, "script"));
    }
}
