scripts.go
func gitWrapperScript() []byte {
	scriptTemplate := `#!/usr/bin/env {shell}

# The MIT License (MIT)
# Copyright (c) 2013 Alvin Abad

if [ $# -eq 0 ]; then
    echo "Git wrapper script that can specify an ssh-key file
Usage:
    git.sh -i ssh-key-file git-command
    "
    exit 1
fi

# remove temporary file on exit
trap 'rm -f {tmp_dir}/.git_ssh.$$' 0

if [ "$1" = "-i" ]; then
    SSH_KEY=$2; shift; shift
    echo -e "#!/usr/bin/env {shell}\n \
    ssh -i $SSH_KEY \$@" > {tmp_dir}/.git_ssh.$$
    chmod +x {tmp_dir}/.git_ssh.$$
    export GIT_SSH={tmp_dir}/.git_ssh.$$
fi

# in case the git command is repeated
[ "$1" = "git" ] && shift

# Run the git command
{git_binary} "$@"

`
	replacer := strings.NewReplacer(
		"{shell}", shell,
		"{tmp_dir}", strings.TrimSuffix(gos.TempDir(), "/"),
		"{git_binary}", gitBinary,
	)
	return []byte(replacer.Replace(scriptTemplate))
}
func gitWrapperScript() []byte {
	scriptTemplate := `#!/usr/bin/env {shell}

# The MIT License (MIT)
# Copyright (c) 2013 Alvin Abad

if [ $# -eq 0 ]; then
    echo "Git wrapper script that can specify an ssh-key file
Usage:
    git.sh -i ssh-key-file git-command
    "
    exit 1
fi

# remove temporary file on exit
trap 'rm -f {tmp_dir}/.git_ssh.$$' 0

if [ "$1" = "-i" ]; then
    SSH_KEY=$2; shift; shift
    echo -e "#!/usr/bin/env {shell}\n \
    ssh -i $SSH_KEY \$@" > {tmp_dir}/.git_ssh.$$
    chmod +x {tmp_dir}/.git_ssh.$$
    export GIT_SSH={tmp_dir}/.git_ssh.$$
fi

# in case the git command is repeated
[ "$1" = "git" ] && shift

# Run the git command
{git_binary} "$@"

`
	replacer := strings.NewReplacer(
		"{shell}", shell,
		"{tmp_dir}", strings.TrimSuffix(gos.TempDir(), "/"),
		"{git_binary}", gitBinary,
	)
	return []byte(replacer.Replace(scriptTemplate))
}
// gitWrapperScript forms content for git.sh script