Skip to content

Issue with editing template to have default value show up in skel correctly.. #3

@Guyverix

Description

@Guyverix

I have run into a bit of trouble with the Template file. I am attempting to add a hard coded set of default values into the skeleton that is created with a new file. Overall the issue is minor, as it is more of a format problem than a real code bug. It is just frustrating as it makes the generated skeleton look sloppy.

Here is what I am attempting to add:

== Skeleton.script-set == nomenu, below ==
#set -o nounset                        # Treat unset variables as an error
#set -o pipefai                        # Any non-zero exits in pipes fail
#set -e                                # Any non-zero exit is a failure
#canonicalpath=`readlink -f $0`                 # Breaks Mac due to readlink differences
#canonicaldirname=`dirname ${canonicalpath}`/.. # Breaks Mac
#samedirname=`dirname ${canonicalpath}`         # Breaks Mac

usage() {
  cat << EOF

EOF
}

while getopts "hx" OPTION; do
  case ${OPTION} in
    h) usage ; exit 0 ;;
    x) export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'; set -x ;;
    *) echo "Unexpected argument given.  Try -h.  Used: $@ ; exit 2 ;;
  esac    # --- end of case ---
done
== ENDTEMPLATE ==

And this is what the generated output looks like:

usage() {
        cat << EOF

                EOF
}

while getopts "hx" OPTION; do
case ${OPTION} in
h) usage ; exit 0 ;;
x) export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'; set -x ;;
*) echo "Unexpected argument given.  Try -h.  Used: $@ ; exit 2 ;;
esac    # --- end of case ---
done

As you can see, I loose some formatting and gain goofed up indents in other areas. What would be the correct way to deal with this in the Template file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions