{"id":13587559,"url":"https://github.com/TekWizely/bash-tpl","last_synced_at":"2025-04-07T22:31:23.780Z","repository":{"id":46128125,"uuid":"376695137","full_name":"TekWizely/bash-tpl","owner":"TekWizely","description":"A smart, lightweight shell script templating engine, written in Bash","archived":false,"fork":false,"pushed_at":"2023-05-03T23:09:04.000Z","size":137,"stargazers_count":60,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T16:42:22.105Z","etag":null,"topics":["bash-script","template-engine"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TekWizely.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-06-14T03:44:03.000Z","updated_at":"2024-04-29T11:30:16.000Z","dependencies_parsed_at":"2024-02-13T21:52:22.808Z","dependency_job_id":"19550d5e-7e53-4f7a-8953-c0164f00f397","html_url":"https://github.com/TekWizely/bash-tpl","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TekWizely%2Fbash-tpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TekWizely%2Fbash-tpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TekWizely%2Fbash-tpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TekWizely%2Fbash-tpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TekWizely","download_url":"https://codeload.github.com/TekWizely/bash-tpl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247740769,"owners_count":20988265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-script","template-engine"],"created_at":"2024-08-01T15:06:15.950Z","updated_at":"2025-04-07T22:31:23.773Z","avatar_url":"https://github.com/TekWizely.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Bash-TPL [![MIT license](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/tekwizely/pre-commit-golang/blob/master/LICENSE)\n\nA Smart, lightweight shell script templating engine, written in Bash.\n\nBash-TPL lets you mark up textual files (config files, yaml, xml, scripts, html, etc.) with shell commands and variable replacements, while minimally impacting your original file layout.\n\nTemplates are compiled into shell scripts that you can invoke (along with variables, arguments, etc.) to generate complete and well-formatted output text files.\n\n#### Features\n\n##### Lightweight\n\nBash-TPL is presented as a single-file Bash script, making it both easy to bring along with your projects, and even easier to use, since there is no need to compile any source code.\n\nSee [Adding `bash-tpl` into your project](#adding-bash-tpl-into-your-project) for more information.\n\n##### Smart Indentation Correction\n\nCreating readable, maintainable templates often requires adding extra whitespace (i.e. indenting lines within a `for` loop) in order to help distinguish your template tags from your textual content.\n\nBash-TPL detects ands removes these extra indentations, resulting in generated text files that look as good as if they were written by hand !\n\n*NOTE: Consistent Formatting*\n\nThe key to success with Bash-TPL's indentation fix-up logic is _Consistent Formatting_ - using consistent indentation throughout your templates will yield best results.\n\n##### Generates Reusable Shell Scripts\n\nThe output of Bash-TPL is a reusable shell script that is then used to generate your final text document(s).\n\nIf desired, you could just bring/ship the intermediate script, with no further need for Bash-TPL until you need to make changes to your original template.\n\n##### Shell Agnostic\n\nThe shell scripts that Bash-TPL generates are not intended to be Bash-specific.\n\nBash-TPL attempts to generate posix printf-compatible statements, utilizing `%s` and `%b`.\n\nAny shell who's printf matches output below should be compatible:\n\n```sh\n$ VARIABLE=Variable\n$ printf \"%b%s%b%s%b\\n\" 'Text:\\t\\0047' \"$VARIABLE\" '\\0047 \"' \"$(echo $VARIABLE)\" '\" $(\\\\n)'\n```\n```text\nText:\t'Variable' \"Variable\" $(\\n)\n```\n\n##### Custom Formatting\n\nAlthough template tags are formatted with `%s` by default, you can customize their format using standard _printf_ format specifiers.\n\nSee [Formatting Text Tags](#formatting-text-tags) for more information.\n\n##### Supports Includes\n\nTemplates can include other templates, making it easy to organize your templates as smaller, reusable components.\n\n*NOTE:* Bash-TPL's smart indentation tracking \u0026amp; correction even works across included templates !\n\nThe indentation of the `include` statement dictates the base indentation of the included file.\n\nSee [INCLUDE directive](#include) for more information.\n\n##### Configurable Delimiters\n\nBash-TPL's default delimiters _should_ accommodate most text file formats without conflict.\n\nBut if you do run into conflicts, or if you just prefer a different style, the delimiters are fully configurable.\n\nYou can even modify delimiters mid-template !\n\nSee  [Customizing Delimiters](#customizing-delimiters) for more information.\n\n*NOTE: Including Templates With Differing Delimiters*\n\nYou can easily include templates that have differing delimiters.\n\nIf the included template doesn't declare its delimiters explicitly (i.e. maybe it relies on the defaults), you can specify the delimiters as part of the include statement.\n\nSee [INCLUDE directive](#include) for more information.\n\n##### Extensive Test Suite\n\nBash-TPL has an extensive test suite built wth [BATS](https://github.com/bats-core/bats-core)\n\n*Older Bash Versions*\n\nThe test suite has been tested against Bash versions `3.2`, `4.4`, `5.0`, and `5.1`\n\n#### TOC\n- [Template Tags](#template-tags)\n  - [Text Tags](#text-tags)\n    - [Formatting Text Tags](#formatting-text-tags)\n  - [Statement Lines](#statement-lines)\n  - [Statement Blocks](#statement-blocks)\n  - [Template Comments](#template-comments)\n- [Directives](#directives)\n  - [INCLUDE](#include)\n  - [DELIMS](#delims)\n  - [RESET-DELIMS](#reset-delims)\n- [Customizing Delimiters](#customizing-delimiters)\n- [Resetting Delimiters](#resetting-delimiters)\n- [Installing](#installing)\n- [Contributing](#contributing)\n- [Contact](#contact)\n- [License](#license)\n  - [Adding `bash-tpl` into your project](#adding-bash-tpl-into-your-project)\n\n--------\n## Using\n\nbash-tpl takes a single template file as input and generates a shell script as output.\n\n_basic usage_\n\n```\n$ bash-tpl my_template.tpl \u003e my_script.sh\n```\n\n#### Reading From STDIN\n\nIn addition to files, bash-tpl can also read directly from `stdin`.\n\nTo read from `stdin`, use a single `-` as the input filename:\n\n_stdin example_\n```\n$ bash-tpl - \u003e hello.sh\nHello, world\n^D\n```\n\n##### Other stdin sources\n\nYou can also use other common `stdin` sources:\n\n_pipe example_\n```\n$ echo \"Hello, world\" | bash-tpl - \u003e hello.sh\n```\n\n_herestring (`\u003c\u003c\u003c`) example_\n```\n$ bash-tpl - \u003c\u003c\u003c \"Hello, world\" \u003e hello.sh\n```\n\n_heredoc (`\u003c\u003c`) example_\n```\n$ bash-tpl - \u003e hello.sh \u003c\u003cEOF\nHello, world\nEOF\n```\n\n**NOTE:** Use of `-` is optional for pipes and herestrings/docs. bash-tpl will try to auto-detect when they are being used.  But if you have any issues, an explicit `-` should help.\n\n#### Specifying Output File\n\nYou can specify the output file using the `-o` or `--output-file` options:\n\n```\n$ bash-tpl --output-file my_script.sh my_template.tpl\n```\n\n#### Display Version\n\n_display bash-tpl version_\n\n```\n$ bash-tpl --version\n```\n\n#### Full Usage Screen\n\nYou can view the full usage screen using the `-h` or `--help` options, or simply by invoking bash-tpl with no options:\n```\n$ bash-tpl --help\n```\n\n----------------\n## Template Tags\n\n### Text Tags\n\nText tags allow you to seamlessly inject dynamic data elements inline with your text.\n\nThey allow you to maintain your template as nicely-formatted text instead of complicated print statements, ie:\n\n#### Standard Tag\n\nHere is a simple template example using the standard text tag:\n\n_hello.tpl_\n```\nHello \u003c% $NAME %\u003e\n```\n\n#### Processing The Template\n\nWe can process the template and review the generated script:\n\n_process the template_\n```\n$ bash-tpl hello.tpl\n\nprintf \"%b%s\\n\" 'Hello ' \"$NAME\"\n```\n\n#### Usage Example\n\nHere's a quick example invoking the template-generated script along with some user data:\n\n_usage example_\n```\n$ NAME=TekWizely source \u003c( bash-tpl hello.tpl )\n\nHello TekWizely\n```\n\n##### Default Delimiters\n\nThe default delimiters for standard tags are `\u003c%` \u0026amp; `%\u003e`\n\nSee the [Customizing Delimiters](#customizing-delimiters) section to learn about the many ways you can customize delimiters to your liking.\n\n##### Trimming\n\n**NOTE:** For standard tags, The value within the delimiters is 'trimmed' before being processed, ie: `'\u003c% $NAME %\u003e'` is equivalent to `'\u003c%$NAME%\u003e'`.\n\nThis is to encourage you to use liberal amounts of whitespace, keeping your templates easy to read and maintain.\n\n#### Quote Tag\n\nQuote tags are similar to standard tags, with the exception that *no trimming* is performed, and leading/trailing whitespace is preserved, ie:\n\n```\nHello \u003c%\" $NAME \"%\u003e\n```\n\nIs equivalent to :\n\n```\nprintf \"%b%s\\n\" 'Hello ' \" $NAME \"  # Whitespace around $NAME is preserved\n```\n\n##### Default Delimiters\n\nThe default delimiters for Quote Tags are `\u003c%\"` \u0026amp; `\"%\u003e`\n\nMore specifically, the delimiters are : Currently-configured Standard Tag delimiters with leading \u0026amp; trailing quotes (`\"`)\n\nNOTE: No whitespace is allowed between the standard tag and the quote character (i.e. `\u003c% \"` would **not** be treated as a quote tag).\n\n##### Example\n\n_hello.tpl_\n```\nHello '\u003c%\" \u003c% $NAME %\u003e \"%\u003e'\n```\n\n```\n$ NAME=TekWizely source \u003c( bash-tpl hello.tpl )\n\nHello ' \u003c% TekWizely %\u003e '\n```\n\n#### Statement Tag\n\nStatement tags allow you to inline script statements, printing the output of the statement:\n\n```\nHello \u003c%% echo $NAME %\u003e\n```\n\nIs equivalent to :\n\n```\nprintf \"%b%s\\n\" 'Hello ' \"$(echo $NAME)\"  # Trivial example to demonstrate the conversion\n```\n\n##### Better Example\n\nA *slightly* more useful example of a statement tag might be:\n\n_hello.tpl_\n```\nHello \u003c%% echo $NAME | tr '[:lower:]' '[:upper:]' %\u003e\n```\n\n```\n$ NAME=TekWizely source \u003c( bash-tpl hello.tpl )\n\nHello TEKWIZELY\n```\n\n##### Default Delimiters\n\nThe default delimiters for Statement Tags are `\u003c%%` \u0026amp; `%\u003e`\n\nMore specifically, the delimiters are : Currently-configured Standard Tag delimiters with the open delimiter followed by the Statement Tag delimiter.\n\n**NOTES:**\n* The statement Tag delimiter (ie the 2nd `%`) can be configured separate from the Standard Tag delimiters. See [Customizing Delimiters](#customizing-delimiters) for details.\n* No whitespace is allowed between the Standard Tag and the Statement Tag delimiter (i.e. `\u003c% %` would **not** be treated as a Statement Tag).\n* The Statement Tag delimiter is *not* part of the close tag (`%\u003e`), **just** the open tag (`\u003c%%`)\n\n##### Trimming\n\n**NOTE:** As with Standard Tags, the value within the statement Tag is 'trimmed' before being processed, ie: `'\u003c%% echo $NAME %\u003e'` is equivalent to `'\u003c%%echo $NAME%\u003e'`.\n\n### Formatting Text Tags\n\nBy default, all Text Tags are rendered with the _printf_ `%s` format specifier.\n\nYou can use a custom format specifier in your tags:\n\n_integer_format.tpl_\n```\n% myint=123\n\u003c%|%d|${myint}%\u003e\n```\n\n_process the template_\n```\n$ bash-tpl integer_format.tpl\n\nmyint=123\nprintf \"%d\\n\" \"${myint}\"\n```\n\n#### Whitespace Ignored\n\nYou can add extra whitespace to make your tags easier to read:\n\n_integer_format_spaced.tpl_\n```\n% myint=123\n\u003c% | %d | ${myint} %\u003e\n```\n\nProcessing the template generates the same output as the above (no-whitespace) example:\n\n_process the template_\n```\n$ bash-tpl integer_format_spaced.tpl\n\nmyint=123\nprintf \"%d\\n\" \"${myint}\"\n```\n\n#### Variable as Format Specifier\n\nOther than trimming whitespace from the beginning/end of the format specifier, the value is passed as-is to the final output.\n\nThis allows you to do things such as use a variable as the format specifier:\n\n_integer_format_var.tpl_\n```\n% myint=123\n% myfmt='%05d'\n\u003c% | ${myfmt} | ${myint} %\u003e\n```\n\n_process the template_\n```\n$ bash-tpl integer_format_var.tpl\n\nmyint=123\nmyfmt='%05d'\nprintf \"${myfmt}\\n\" \"${myint}\"\n```\n\nInvoking the template shows that the output is formatted according to the value of `${myfmt}`:\n\n_invoke template script_\n```\n$ source \u003c( bash-tpl integer_format_var.tpl )\n\n00123\n```\n\n#### Default Delimiters\n\nThe default delimiters for the format specifier are `|` \u0026amp; `|`\n\nYou can customize the delimiters:\n\n_customized_format_delimiters.tpl_\n```\n.DELIMS tag-fmt=\"[ ]\"\n% myint=123\n\u003c%[%d] $myint %\u003e\n```\n\n_process the template_\n```\n$ bash-tpl customized_format_delimiters.tpl\n\nmyint=123\nprintf \"%d\\n\" \"$myint\"\n```\n\nSee the [Customizing Delimiters](#customizing-delimiters) section to learn about the many ways you can customize delimiters to your liking.\n\n-------------------\n### Statement Lines\n\nStatement lines allow you to easily insert a single line of script into your template:\n\n_test.tpl_\n```\n% [ -z \"$1\" ] \u0026\u0026 echo \"Error: Missing argument\" \u003e\u00262 \u0026\u0026 return\nHello \u003c% $1 %\u003e\n```\n\n_test with no arguments_\n```\n$ source \u003c( bash-tpl test.tpl )\n\nError: Missing argument\n```\n\n_test with argument_\n```\n$ source \u003c( bash-tpl test.tpl ) TekWizely\n\nHello TekWizely\n```\n\n--------------------\n### Statement Blocks\n\nStatement blocks allow you to add a full script block into your template:\n\n```\n%\n    if [ -z \"${1}\" ]; then\n        echo \"Error: Missing argument\" \u003e\u00262\n        return\n    fi\n%\nHello \u003c% $1 %\u003e\n```\n\n**NOTE:** Statement Block delimiters must be on their own line with no other non-whitespace characters.\n\n_test with no arguments_\n```\n$ source \u003c( bash-tpl test.tpl )\n\nError: Missing argument\n```\n\n_test with argument_\n```\n$ source \u003c( bash-tpl test.tpl ) TekWizely\n\nHello TekWizely\n```\n\n##### Default Delimiter\n\nThe default start \u0026amp; stop delimiter for Statement Blocks is `%`\n\nMore specifically, the default is : Currently-configured Statement Line delimiter.\n\n#### Printing Text Within a Statement Block\n\nSometimes parts (or all) of your template may consist of complex code that just needs to print a small amount of text.\n\nYou could close and re-open your statement blocks, but that might feel verbose depending on the situation:\n\n_verbose.tpl_\n```\n%\n    # ...\n    if (condition); then\n%\ncondition text ...\n%\n    else\n%\nelse text ...\n%\n    fi\n    # ...\n%\n```\n\nBash-tpl allows you to print single lines of text within your statement blocks:\n\n_inline.tpl_\n```\n%\n    # ...\n    if (condition); then\n        % condition text ...\n    else\n        % else text ...\n    fi\n    # ...\n%\n```\n\n**NOTES:**\n* The indentation of the printed text lines will always match that of the statement block start tag\n* This is to encourage you to format your text lines within the context of your script\n* All whitespace _after_ the text line tag (`'% `') will be printed as-as\n\n##### Similar Script Output\n\nThe two techniques generate nearly-identical scripts, but the inline script is slightly easier to read:\n\n_verbose.sh_\n```bash\n# ...\nif (condition); then\nprintf \"%b\\n\" 'condition text ...'\nelse\nprintf \"%b\\n\" 'else text ...'\nfi\n# ...\n```\n\n_inline.sh_\n```bash\n# ...\nif (condition); then\n    printf \"%b\\n\" 'condition text ...'\nelse\n    printf \"%b\\n\" 'else text ...'\nfi\n# ...\n```\n\n##### Default Delimiter\n\nThe default delimiter for a Statement Block Text Line  is `'% '` (note the trailing space `' '`)\n\nMore specifically, the default is : Currently-configured Statement Line delimiter, followed by a space (`' '`)\n\n---------------------\n### Template Comments\n\n_test.tpl_\n```\n%# This comment will be removed from the template script\n% # This comment will remain as part of the template script\nHello world\n```\n\n_view raw template script_\n```\n$ bash-tpl test.tpl\n\n# This comment will remain as part of the template script\nprintf \"%b\\n\" 'Hello world'\n```\n\n_invoke template script_\n```\n$ source \u003c( bash-tpl test.tpl )\n\nHello world\n```\n\n--------------\n### Directives\n\n#### INCLUDE\n\n_test.tpl_\n```\nARGS:\n  %# Due to smart indentation tracking,\n  %# indentations within the while statement are removed.\n  % while (( \"$#\" )); do\n      %# Indentation is even tracked across includes\n      .INCLUDE include.tpl\n      % shift\n  % done\n```\n\n_include.tpl_\n```\n- \u003c% $1 %\u003e\n```\n\n```\n$ source \u003c( bash-tpl test.tpl ) a b c d\n\nARGS:\n  - a\n  - b\n  - c\n  - d\n```\n\n**Support for potentially-missing files**\n\nYou can safely attempt to include a potentially-missing file using `.INCLUDE?`\n\n_no errors if include file is missing_\n```\n.INCLUDE? optional-file.tpl\n```\n\n**NOTES:**\n* The current delimiter configuration is passed to the included template\n* You can pass command-line options (i.e `--tag-delims`, `--reset-delims`, etc)\n\n#### DELIMS\n\nConfigure one or more template delimiters from *within* your template.\n\n_test.tpl_\n```\n%# We change the stmt block and tag delims\n%# NOTE: Both the '=' and double-quotes (\") are required\n.DELIMS stmt-block=\"\u003c% %\u003e\" tag=\"{{ }}\"\n\u003c%\n    if [ -z \"${1}\" ]; then\n        echo \"Error: Missing argument\" \u003e\u00262\n        return\n    fi\n%\u003e\nHello {{ $1 }}\n```\n\n```\n$ source \u003c( bash-tpl test.tpl ) TekWizely\n\nHello TekWizely\n```\n\n**NOTES:**\n* Both the `=` and Double-Quotes (`\"`) shown in the example script are **required**\n* The changes take effect immediately (i.e. the very next line)\n* The changes are passed along to any included templates\n\nThe DELIMS directive accepts the following parameters:\n\n| PARAM                | FORMAT     | NOTE                                                          |\n|----------------------|------------|---------------------------------------------------------------|\n| TAG                  | `\".. ..\"`  | 2 two-char sequences, separated by a **single** space         |\n| TAG-STMT             | `\".\"`      | 1 single character                                            |\n| TAG-FMT              | `\". .\"`    | 2 single characters, separated by a **single** space          |\n| STMT                 | `\".+\"`     | 1 or more characters                                          |\n| STMT-BLOCK           | `\".+ .+\"`  | 2 one-or-more char sequences, separated by a **single** space |\n| TXT \u0026#124; TEXT      | `\".+[ ]?\"` | 1 or more characters, with an optional trailing space         |\n| DIR \u0026#124; DIRECTIVE | `\".+\"`     | 1 or more characters                                          |\n| CMT \u0026#124; COMMENT   | `\".+\"`     | 1 or more characters                                          |\n\n\n#### RESET-DELIMS\n\nReset **all** delimiters to their default values from *within* you template.\n\n_test.tpl_\n```\n% echo \"default statement delim\"\n.DELIMS stmt=\"$\u003e\"\n$\u003e echo \"modified statement delim\"\n.RESET-DELIMS\n% echo \"back to default statement delim\"\n```\n\n```\n$ source \u003c( bash-tpl test.tpl )\n\ndefault statement delim\nmodified statement delim\nback to default statement delim\n```\n\n--------------------------\n### Customizing Delimiters\n\nThere are several ways to customize delimiters for your templates.\n\n#### Environment Variables\n\nYou can change the default delimiters globally via the following environment variables:\n\n| VARIABLE                   | FORMAT     | NOTE                                                          |\n|----------------------------|------------|---------------------------------------------------------------|\n| BASH_TPL_TAG_DELIMS        | `\".. ..\"`  | 2 two-char sequences, separated by a **single** space         |\n| BASH_TPL_TAG_STMT_DELIM    | `\".\"`      | 1 single character                                            |\n| BASH_TPL_TAG_FMT_DELIMS    | `\". .\"`    | 2 single characters, separated by a **single** space          |\n| BASH_TPL_STMT_DELIM        | `\".+\"`     | 1 or more characters                                          |\n| BASH_TPL_STMT_BLOCK_DELIMS | `\".+ .+\"`  | 1 one-or-more char sequences, separated by a **single** space |\n| BASH_TPL_TEXT_DELIM        | `\".+[ ]?\"` | 1 or more characters, with an optional trailing space         |\n| BASH_TPL_DIR_DELIM         | `\".+\"`     | 1 or more characters                                          |\n| BASH_TPL_CMT_DELIM         | `\".+\"`     | 1 or more characters                                          |\n\n##### quick example\n\n_test.tpl_\n```\n%# customize standard tag delimiter\nHello, {{ $1 }}\n```\n\n```\n$ BASH_TPL_TAG_DELIMS=\"{{ }}\" bash-tpl test.tpl \u003e test.sh\n$ . test.sh TekWizely\n\nHello, TekWizely\n```\n\n#### Command Line Options\n\nThe following command line options are available for customizing delimiters:\n\n| OPTION                               | FORMAT     | NOTE                                                          |\n|--------------------------------------|------------|---------------------------------------------------------------|\n| --tag-delims                         | `\".. ..\"`  | 2 two-char sequences, separated by a **single** space         |\n| --tag-stmt-delim                     | `\".\"`      | 1 single character                                            |\n| --tag-fmt-delims                     | `\". .\"`    | 2 single characters, separated by a **single** space          |\n| --stmt-delim                         | `\".+\"`     | 1 or more characters                                          |\n| --stmt-block-delims                  | `\".+ .+\"`  | 2 one-or-more char sequences, separated by a **single** space |\n| --txt-delim \u0026#124; --text-delim      | `\".+[ ]?\"` | 1 or more characters, with an optional trailing space         |\n| --dir-delim \u0026#124; --directive-delim | `\".+\"`     | 1 or more characters                                          |\n| --cmt-delim \u0026#124; --comment-delim   | `\".+\"`     | 1 or more characters                                          |\n\n**NOTE:** Command-line options override environment variables.\n\n##### quick example\n\n_test.tpl_\n```\n%# customize standard tag delimiter\nHello, {{ $1 }}\n```\n\n```\n$ bash-tpl --tag-delims \"{{ }}\" test.tpl \u003e test.sh\n$ . test.sh TekWizely\n\nHello, TekWizely\n```\n\n#### DELIMS Directive\n\nYou can use the [DELIMS Directive](#delims) to configure delimiters from *within* your template.\n\n**NOTE:** DELIMS options override both environment variables and command-line options.\n\n### Resetting Delimiters\n\nThere are a couple of ways to reset the delimiters back to their default values.\n\n#### Command-Line Option\n\nYou can use the `--reset-delims` option to reset the delimiters to defaults:\n\n```\n$ bash-tpl --reset-delims test.tpl\n```\n\n**NOTES:**\n* Overrides environment variables\n* Overrides any commend-line options that appear *before* the `--reset-delims` option\n* Does **not** override any command-line options that appear *after* the `--reset-delims` option\n* Can be passed as an option in an [INCLUDE](#include) directive, ie:\n  ```\n  .INCLUDE my_include.tpl --reset-delims\n  ```\n\n#### RESET-DELIMS Directive\n\nYou can use the [RESET-DELIMS Directive](#reset-delims) to reset delimiters from *within* your template.\n\n-------------\n## Installing\n\n### Releases\n\nSee the [Releases](https://github.com/TekWizely/bash-tpl/releases) page for downloadable archives of versioned releases.\n\n#### Brew Core\nTBD\n\n#### Brew Tap\n\nIn addition to working on brew core support, I have also created a tap to ensure the latest version is always available:\n\n* https://github.com/TekWizely/homebrew-tap\n\n_install bash-tpl directly from tap_\n```\n$ brew install tekwizely/tap/bash-tpl\n```\n\n_install tap to track updates_\n```\n$ brew tap tekwizely/tap\n\n$ brew install bash-tpl\n```\n## Similar Tools\n\nHere's a list of some similar tools I discovered before deciding to create bash-tpl :\n* [mo - mustache templates in bash](https://github.com/tests-always-included/mo)\n* [esh - embedded shell (written in sh)](https://github.com/jirutka/esh)\n* [envsubst (part of gnu gettext)](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html)\n* [shtpl (written in bash)](https://github.com/mlorenzo-stratio/shtpl)\n* [shtpl (written in vala)](https://github.com/dontsueme/shtpl)\n* [cookie (written in bash)](https://github.com/bbugyi200/cookie)\n* [bash-templater](https://github.com/vicentebolea/bash-templater)\n* [renderest (written in bash)](https://github.com/relaxdiego/renderest)\n* [rc template language](https://werc.cat-v.org/docs/rc-template-lang)\n* [pp shell-based pre-processor](https://adi.onl/pp.html)\n\n---------------\n## Contributing\n\nTo contribute to Bash-TPL, follow these steps:\n\n1. Fork this repository.\n2. Create a branch: `git checkout -b \u003cbranch_name\u003e`.\n3. Make your changes and commit them: `git commit -m '\u003ccommit_message\u003e'`\n4. Push to the original branch: `git push origin \u003cproject_name\u003e/\u003clocation\u003e`\n5. Create the pull request.\n\nAlternatively see the GitHub documentation on [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).\n\n----------\n## Contact\n\nIf you want to contact me you can reach me at TekWizely@gmail.com.\n\n----------\n## License\n\nThe `tekwizely/bash-tpl` project is released under the [MIT](https://opensource.org/licenses/MIT) License.  See `LICENSE` file.\n\n##### Adding `bash-tpl` into your project\n\nThe `bash-tpl` script has an embedded MIT [SPDX](https://spdx.org/licenses/MIT.html) header, as well as a license header, and should be safe for you to extract and add to your own projects for easy template generation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTekWizely%2Fbash-tpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTekWizely%2Fbash-tpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTekWizely%2Fbash-tpl/lists"}