dokku / plugn

Hook system that lets users extend your application with plugins
MIT License
82 stars 22 forks source link

Fix missing newlines #2

Closed lalyos closed 9 years ago

lalyos commented 9 years ago

The concatenated bashenv file gets syntax error

Reproduce the error

$ docker run -ti --rm  golang bash -c 'go get github.com/progrium/plugn; plugn'

/tmp/bashenv.259506031: line 226: syntax error: unexpected end of file
bash: main: command not found

Missing newline

Here is the generated /tmp/bashenv.259506031 , which show how main() and toml-get() slips together

main() {
        set -eo pipefail; [[ "$TRACE" ]] && set -x
        export BASH_ENV=
        if [[ ! "$PLUGIN_PATH" ]]; then
                echo "!! PLUGIN_PATH is not set in environment"
                exit 2
        fi

        cmd-export install
        cmd-export uninstall
        cmd-export list
        cmd-export trigger
        cmd-export enable
        cmd-export disable
        cmd-export-ns config "Plugin configuration"
        cmd-export config-get
        cmd-export config-export
        cmd-export config-set
        cmd-export init

        cmd-ns "" "$@"
}toml-get() { $PROGRAM :: toml-get "$@"; }
toml-set() { $PROGRAM :: toml-set "$@"; }
toml-export() { $PROGRAM :: toml-export "$@"; }