{"id":15042470,"url":"https://github.com/jmurowaniecki/jumpstart-bash","last_synced_at":"2025-04-14T20:33:27.420Z","repository":{"id":57039477,"uuid":"102001979","full_name":"jmurowaniecki/jumpstart-bash","owner":"jmurowaniecki","description":"Bootstrap model for Bash scripts","archived":false,"fork":false,"pushed_at":"2019-02-22T20:38:15.000Z","size":82,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T08:51:13.525Z","etag":null,"topics":["bash","bash-completion","bash-script","bash-template","friendly","helper","template"],"latest_commit_sha":null,"homepage":null,"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/jmurowaniecki.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-31T13:10:39.000Z","updated_at":"2022-09-15T16:57:15.000Z","dependencies_parsed_at":"2022-08-24T00:51:17.775Z","dependency_job_id":null,"html_url":"https://github.com/jmurowaniecki/jumpstart-bash","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmurowaniecki%2Fjumpstart-bash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmurowaniecki%2Fjumpstart-bash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmurowaniecki%2Fjumpstart-bash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmurowaniecki%2Fjumpstart-bash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmurowaniecki","download_url":"https://codeload.github.com/jmurowaniecki/jumpstart-bash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248956265,"owners_count":21189321,"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","bash-completion","bash-script","bash-template","friendly","helper","template"],"created_at":"2024-09-24T20:47:21.512Z","updated_at":"2025-04-14T20:33:27.399Z","avatar_url":"https://github.com/jmurowaniecki.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"assets/jumpstart.png\"\u003e Jump Start\n[![StyleCI](https://styleci.io/repos/102001979/shield?branch=master)](https://styleci.io/repos/102001979) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8c024327353741839413296650fe883f)](https://www.codacy.com/app/jmurowaniecki/jumpstart-bash?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=jmurowaniecki/jumpstart-bash\u0026utm_campaign=Badge_Grade)\n\n**Jump Start** was concepted to be an easy and lightweight boilerplate for your tools using modularity to manage readability and producing a self-deployment solution. Although you can use `jumpstart` to handle self-contained tools, it can be used to manage multiple recipes in a _global_ environment.\n\nAiming to solve structural gaps due to some [classical language limitations](https://mywiki.wooledge.org/BashWeaknesses), allowing to perform autocompletion and generate documentation based initially on  function declarations source code annotations, **Jump Start** intent to be your weapon of choice to start from small sized projects to complex solutions without leaving your [state of art](https://github.com/jlevy/the-art-of-command-line).\n\n[Bash is a really powerfull tool](https://www.tldp.org/LDP/abs/html/) and there are a lot of [online documentation](http://web.mit.edu/~linux/docs/howto/Adv-Bash-Scr-HOWTO), [good](https://github.com/bahamas10/bash-style-guide) [practices](https://devmanual.gentoo.org/tools-reference/bash/), [style guidance](https://google.github.io/styleguide/shell.xml), advices and tools for [validation, static analysis and linting](https://github.com/koalaman/shellcheck) to ensure code quality and maintainability.\n\n\n## Getting start\n\n### Instalation\n\n### Compatibility check\n\n### Hands on\n\n#### Creating a small and self-contained application\n\n#### Creating a complex and self-deployable solution\n\n### Solving problems\n\n## Structure\n\n#### #! _(aka: Shebang)_\n\n[Standart declaration of the program loader](https://en.wikipedia.org/wiki/Shebang_(Unix)) are commonly the first line of the executable file that specifies the interpreter and environmental parameters.\n\n```bash\n#!/usr/bin/env bash\n```\n\u003e _Means that our script runs over Bash._\n\n\n#### Document heading\n\nDescribes script name, description, usage, authors and how/where to get more information (repository links, and more).\n\n```bash\n#\n# TITLE       : Template title.\n# DESCRIPTION : Template description.\n# AUTHOR      : Your Name \u003cyour@email\u003e\n# DATE        : 20170825\n# VERSION     : 7.6.2-33\n# USAGE       : bash template.sh or ./template.sh or ..\n# REPOSITORY  : https://github.com/YOUR_USER/your_project\n#\n```\n\n#### Versioning\n\nUse the ID and version variables to efficiently and efficiently track features and bugs by keeping those values up to date with your favorite versioner's tags [in the way that suits you best](http://semver.org/).\n\n```bash\nAPP_TITLE=\"${Cb}λ${Cn} Template\"\n\nAPP_MAJOR=0\nAPP_MINOR=0\nAPP_REVISION=0\nAPP_PATCH=0\n#\n#   AVOID change above the safety line.\n#\n# --------------------------------------- SAFETY LINE -------------\nAPP_VERSION=\"${APP_MAJOR}.${APP_MINOR}.${APP_REVISION}-${APP_PATCH}\"\n```\n\n\n#### Development area _(fun zone)_\n\nThe functions below exemplify where to stay and how to document the functions so that they are properly displayed as options by the script helper.\n\n```bash\nfunction example {\n    # Explains how documentation works\n\n    $_e \"I don't know what to do\"\n}\n\nfunction colors {\n    # Show color/style variable table\n\n    $_e \"Color/style variables:\n\n    ${Cb}Cn${Cn}     ${Cn}Normal/reset${Cn}\n    ${Cb}Cb${Cn}     ${Cb}Bold${Cn}\n    ${Cb}Ci${Cn}     ${Ci}Italic${Cn}\n    ${Cb}Cd${Cn}     ${Cd}Dark/gray${Cn}\n    ${Cb}Cr${Cn}     ${Cr}Red${Cn}\n    ${Cb}Cg${Cn}     ${Cg}Green${Cn}\n    ${Cb}Cc${Cn}     ${Cc}Cian/Blue${Cn}\n    ${Cb}Cy${Cn}     ${Cy}Yellow${Cn}\"\n}\n```\n\n\u003e Note that the `$_e` variable is used as a substitute for the `echo -e` command as a sole aesthetic purpose.\n\n\n#### Auxiliary functions\n\nSets the default error message if the parameter entered is not a valid command.\n```bash\n#\n#   AVOID change above the safety line.\n#\n# --------------------------------------- SAFETY LINE -------------\nDEFAULT_ERROR_MESSAGE=\"Warning: ${Cb}$1${Cn} is an invalid command.\"\n```\n\n\n##### Lazy helper\n\nDisplays help for supported application parameters.\n\n```bash\nfunction help {\n    # Show this content.\n\n    success message \"${EMPTY}\"\n\n    $_e \"\n${APP_TITLE} v${APP_VERSION}\n\nUsage: ${Cb}$0${Cn} [${Cb}help${Cn}|..] ..\n\nParameters:\n\"\n    commands=\"$(grep 'function ' -A1 \u003c \"$0\" | \\\n        awk -F-- '{print($1)}'  | \\\n        sed -r 's/fu''nction (.*) \\{$/\\\\t\\\\'\"${Cb}\"'\\1\\\\'\"${Cn}\"'\\\\t/' | \\\n        sed -r 's/\\s+# (.*)$/@ok\\1/' | \\\n        grep '@ok' -B1 | \\\n        sed -e 's/\\@ok//')\"\n    $_e \"${commands}\" | tr '\\n' '\\ ' | sed -e 's/--/\\n/g'\n\n    success || fail 'Something terrible happens.'\n}\n```\n\u003e To have your method descriptions displayed correctly, include a comment line summarizing their operation just below the function definition - as suggested in the examples above.\n\n\n##### Prompting Yes/No\n\n```bash\n#\n# HELPERS\n#\n         confirmYesNo=\nfunction confirmYesNo {\n    Y=y; N=n\n    if [ $# -gt 1 ]\n    then case ${1^^} in\n        -DY) Y=${Y^}; d=Y;;\n        -DN) N=${N^}; d=N;;\n        esac\n        m=$2\n    else\n        m=$1\n    fi\n     option=\"($Y/$N)? \"\n     $_e -n \"$m ${option}\"\n    read -n 1 m -r;c=${m^}\n    case $c in\n        Y|N) n=$c;;\n          *) n=$d;;\n    esac\n    export confirmYesNo=$n;\n}\n```\n\n\n##### Success and failure messages\n\n```bash\n# Hold a success message.\n#\n# Ex.:\n#       success message \"all commands executed\"\n#       command1\n#       command2\n#       command3 || fail \"command 3 fail\"\n#       success\n#\n#  will execute command1, command2, command3 and print: \"all commands executed\"\n#  when success.\nfunction success {\n    if [ \"$1\"  == \"message\" ]\n    then   success_message=\"$2\"; return 0; fi\n    $_e \"${success_message}\"\n    $_e \u0026\u0026 success_message=\n}\n\n#\n# Trigger a failure message with exit.\n#\n# Ex.:\n#       success message \"all commands executed\"\n#       command1\n#       command2\n#       command3 || fail \"command 3 fail\"\n#       success\n#\n#  will execute command1, command2, command3 and print: \"command 3 fail\"\n#  when command 3 fails.\nfunction fail {\n    $_e \"$@\" \u0026\u0026 exit 1\n}\n```\n\n\u003e The use of `fail` shows a message quitting script.\n\n\n\n##### Check if given parameter are a valid function inside the actual function scope\n\n```bash\n#\n# FUNCTION CALLER\nif [ ${#} -eq 0 ]\nthen help\nelse [ \"$(functionExists \"$1\")\" != \"YES\" ] \\\n        \u0026\u0026 help \\\n        \u0026\u0026 fail \"${DEFAULT_ERROR_MESSAGE}\"\n\n    \"$@\"\nfi\n```\n\n---\n\n## TODO\n\n-   [Implement `traps`](http://redsymbol.net/articles/bash-exit-traps/);\n-   Tutorials;\n-   Autobuild increments version signature;\n-   Improve function `confirmYesNo`;\n-   Modularize README into a wiki or something like;\n-   GIT versioning integration;\n\n---\n\n# License, warranties and terms of use\n\nThe author is not liable for misuse and/or damage caused by free use and/or distribution of this tool.\n\n## \u003cdiv style=\"text-align:center\"\u003eThe MIT License (MIT)\u003c/div\u003e\n\n### \u003cdiv style=\"text-align:center\"\u003eCopyright © 2017 λ::lambda, CompilouIT, John Murowaniecki.\u003c/div\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n_The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software._\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmurowaniecki%2Fjumpstart-bash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmurowaniecki%2Fjumpstart-bash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmurowaniecki%2Fjumpstart-bash/lists"}