{"id":13602821,"url":"https://github.com/pforret/bashew","last_synced_at":"2025-04-06T16:11:38.775Z","repository":{"id":51916514,"uuid":"285350401","full_name":"pforret/bashew","owner":"pforret","description":"bash script micro-framework - from small stand-alone script to complex projects with CI/CD and testing","archived":false,"fork":false,"pushed_at":"2024-05-19T19:17:42.000Z","size":1415,"stargazers_count":273,"open_issues_count":0,"forks_count":22,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T13:09:04.265Z","etag":null,"topics":["bash","bash-script","bash-scripting","basher","bashew","boilerplate-template","option-parsing","shellcheck","template"],"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/pforret.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-05T16:46:51.000Z","updated_at":"2025-03-06T02:50:39.000Z","dependencies_parsed_at":"2023-01-30T21:30:49.189Z","dependency_job_id":"ed7ab783-b26e-485a-82f8-f4963faa3589","html_url":"https://github.com/pforret/bashew","commit_stats":null,"previous_names":[],"tags_count":78,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pforret%2Fbashew","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pforret%2Fbashew/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pforret%2Fbashew/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pforret%2Fbashew/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pforret","download_url":"https://codeload.github.com/pforret/bashew/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509223,"owners_count":20950232,"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-script","bash-scripting","basher","bashew","boilerplate-template","option-parsing","shellcheck","template"],"created_at":"2024-08-01T18:01:39.048Z","updated_at":"2025-04-06T16:11:38.752Z","avatar_url":"https://github.com/pforret.png","language":"Shell","readme":"[![Shellcheck CI](https://github.com/pforret/bashew/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/pforret/bashew/actions/workflows/shellcheck.yml)\n[![bash_unit CI](https://github.com/pforret/bashew/actions/workflows/bash_unit.yml/badge.svg)](https://github.com/pforret/bashew/actions/workflows/bash_unit.yml)\n[![version](https://img.shields.io/github/v/tag/pforret/bashew)](https://github.com/pforret/bashew/tags)\n[![version](https://img.shields.io/github/v/release/pforret/bashew)](https://github.com/pforret/bashew/releases)\n\nPart of [![part of Bashful Scripting network](https://img.shields.io/badge/bashful-scripting-orange)](https://blog.forret.com/portfolio/bashful/) network\n/\nInstall with [![basher install](https://img.shields.io/badge/basher-install-white?logo=gnu-bash\u0026style=flat)](https://www.basher.it/package/)\n\n# bashew.sh\n\n![Bashew Logo](assets/bashew.jpg)\n\nbash script / project creator\n\n## ⏳ TL;DR\n\nto create a new stand-alone **SCRIPT** (just a xyz.sh script), with option parsing, color output (cf `1.`)\n\n        bashew.sh script\n    \nto create a new standalone script **PROJECT** (in a folder, with README) (cf `2.`)\n\n        bashew.sh project\n\nto initialize a bashew-based **REPO** with CI/CD you just cloned (cf `3.`)\n\n        bashew init\n     \n## 🎯 Features\n\n### Self-contained\n* all code contained in 1 single file (no external dependencies)\n* comes with `README.md`, `CHANGELOG.md`, ... markdown files\n* edit only `Script:main()` function and subroutines in beginning of script, all template code is at the end of the script\n\n### Option parsing\n* definition of flags/options/parameters in 1 place only\n* automatic creation of usage text based on definition above\n* short/long option parsing, based on definition above\n* option `--lorem [value]` is available inside the script as `$lorem`\n\n### [function library](doc/functions.md)\n* `IO:` functions for IO, with intelligent color usage (not when output is piped) (e.g. `IO.success`, `IO.die`)\n* `Str:` functions for string manipulation (e.g `Str:lower`, `Str:digest`)\n* `Os:` functions for e.g. required program checking (e.g. `Os:require convert imagemagick`)\n\n### [batteries included](doc/features.md)\n* read multiple `.env` configuration files\n* predefined `--quiet` (no output) and `--verbose` (more output) modes\n* folder for temporary files (with automatic cleanup)\n* folder for log files (with automatic cleanup)\n* correct determination of script installation folder (resolve symbolic links)\n* easy CI/CD for Github (with shellcheck)\n\n## 🔥 Usage\n\n```ini\nProgram: bashew 1.18.2 by peter@forret.com\nUpdated: May  1 16:49:18 2022\nDescription: package_description\nUsage: bashew [-h] [-q] [-v] [-f] [-l \u003clog_dir\u003e] [-t \u003ctmp_dir\u003e] [-n \u003cname\u003e] \u003caction\u003e\nFlags, options and parameters:\n    -h|--help        : [flag] show usage [default: off]\n    -q|--quiet       : [flag] no output [default: off]\n    -v|--verbose     : [flag] output more [default: off]\n    -f|--force       : [flag] do not ask for confirmation (always yes) [default: off]\n    -l|--log_dir \u003c?\u003e : [option] folder for debug files   [default: /Users/pforret/log/bashew]\n    -t|--tmp_dir \u003c?\u003e : [option] folder for temp files  [default: /tmp/bashew]\n    -n|--name \u003c?\u003e    : [option] name of new script or project\n    \u003caction\u003e         : [parameter] action to perform: script/project/init/update\n```\n\n### 1. create new bash script (without repo)\n```shell\nbashew.sh script                    # will interactively ask for author \u0026 script details\nbashew.sh -f script                 # will create new script with random name\nbashew.sh -f -n \"../list.sh\" script # will create new script ../list.sh\n```\n\nExample:\n```console\n$ bashew script\n⏳  1. first we need the information of the author\nAuthor full name         (pforret) \u003e Peter Forret\nAuthor email             (peter@forret.com) \u003e \nAuthor (github) username (pforret) \u003e \n⏳  2. now we need the path and name of this new script/repo\nScript name (./bespoke_bunny.sh) \u003e \n⏳  3. give some description of what the script should do\nScript description (This is my script bespoke_bunny) \u003e process log files\n⏳  Creating script ./bespoke_bunny.sh ...\n./bespoke_bunny.sh\n\n$ bashew -f script \n⏳  Creating script ./mediums_appease.sh ...\n./mediums_appease.sh\n```\n\n### 2. create new bash project folder/repo (with README.md, CI/CD)\n```console\n$ bashew project               # will interactively ask for author \u0026 script details\nor\n$ bashew -f project            # will create new project with random name\nor\n$ bashew -f -n \"tango\" project # will create new project in folder \"tango\"\n```\n\nExample:\n```console\n$ bashew -f project\n⏳  Creating project ./bounden_brawled ...\nCHANGELOG.md README.md VERSION.md LICENSE .gitignore .env.example bounden_brawled.sh bitbucket-pipelines .github  \n✅  next step: 'cd ./bounden_brawled' and start scripting!\n```\n\n### 3. create a bash script repo, with CI/CD, with README, with tests, with versioning ... \n\n* on [github.com/pforret/bashew](https://github.com/pforret/bashew), click on '**Use this template**'\n* then clone your new repo\n```console\n$ git clone https://github.com/\u003cyou\u003e/\u003cyour repo\u003e.git\n$ cd \u003cyour repo\u003e\n$ ./bashew.sh init             # will ask for details and initialise/clean up the repo\n```\n\n#### and then, if you have [setver.sh](https://github.com/pforret/setver):\n```console\n$ setver push          # will commit and push new code\n$ setver new patch     # will set new version to 0.0.1\n$ setver set 1.0.0     # when your first working version is committed\n```\n  \n### 4. git clone into new repo\n```console\n$ git clone --depth=1 https://github.com/pforret/bashew.git \u003cnewname\u003e\n$ cd \u003cnewname\u003e\n$ ./bashew.sh init             # will ask for details and iniialise/clean up the repo\n```\n\n## 🚀 Installation\n\n* manually\n````console\n$ git clone https://github.com/pforret/bashew.git\n$ ln -s bashew/bashew.sh /usr/local/bin\n````\n    \n* or with [basher](https://github.com/basherpm/basher) package manager\n  [![basher install](https://img.shields.io/badge/basher-install-white?logo=gnu-bash\u0026style=flat)](https://basher.gitparade.com/package/)\n\n````console\n$ basher install pforret/bashew\n````\n\n## 🦪 Built with Bashew\n\n* [bumpkeys](https://github.com/pforret/bumpkeys): upgrade your SSH keys for better security\n* [crontask](https://github.com/pforret/crontask): call scripts or URLs from a crontab file, with optional logging and webhook upon success/failure\n* [jekyll_taxonomy](https://github.com/pforret/jekyll_taxonomy): Generate tag and category pages for Jekyll static sites\n* [m1_homebrew](https://github.com/pforret/m1_homebrew): Install homebrew in native mode on Apple MacOS ARM\n* [mkdox](https://github.com/pforret/mkdox): create and run Mkdocs Material websites using Docker image\n* [netcheck](https://github.com/pforret/netcheck): test network: interfaces, gateway, router, internet\n* [note](https://github.com/pforret/note): Manage your notes, todo, ... with this nifty script\n* [pa](https://github.com/pforret/pa): like \"php artisan\" but more intelligent (use optimal PHP version for the project\n* [progressbar](https://github.com/pforret/progressbar): Easy, clever progress bar for (bash) scripts\n* [rexec](https://github.com/pforret/rexec): repeat a command and be alerted when the output changes\n* [saild](https://github.com/pforret/saild): Start up your Laravel Sail dev setup in one go - Docker, Browser, Shell\n* [screenshots](https://github.com/pforret/screenshots): Let GitHub automatically make 📸 screenshots of all your websites\n* [setver](https://github.com/pforret/setver): Easy semver tool -- get/set git version (one-line superfast git commit)\n* [shaml](https://github.com/pforret/shaml): Read YAML files inside bash scripts\n* [shini](https://github.com/pforret/shini): Read INI files inside bash scripts\n* [shlaunch](https://github.com/pforret/shlaunch): Launch desktop/GUI apps from CLI (e.g. Chrome, PHPStorm, Photoshop ...)\n* [shlorem](https://github.com/pforret/shlorem): Lorem Ipsum generator for the command line\n* [shmixcloud](https://github.com/pforret/shmixcloud): download Mixcloud shows and add album art to m4a files\n* [shoarma](https://github.com/pforret/shoarma): Static Image Site Generator - make e.g. Jekyll posts from folder of images\n* [shtext](https://github.com/pforret/shtext): Text manipulation in bash, by always using the fastest method\n* [shwiki](https://github.com/pforret/shwiki): Wikipedia CLI in bash\n* [shwordle](https://github.com/pforret/shwordle): Wordle-clone with variable # of letters and multiple languages\n* [splashmark](https://github.com/pforret/splashmark): download/create (unsplash/pixabay/replicate) pics and resize/add effects/add attribution/watermark\n* [teams-cli](https://github.com/cinemapub/teams-cli): Send messages to MS Teams channels from CLI\n* [xkcd](https://github.com/pforret/xkcd): View a XKCD comic in your console/TTY\n\n\n## 🙏 Acknowledgements\n\n* [bash_unit](https://github.com/pgrange/bash_unit): bash unit testing enterprise edition framework (used for CI/CD)\n* [shellcheck](https://github.com/koalaman/shellcheck): a static analysis tool for shell scripts (used for CI/CD)\n* [bash-boilerplate (2012)](https://github.com/oxyc/bash-boilerplate) on which I based my [bash-boilerplate (2020)](https://github.com/pforret/bash-boilerplate) which eventually became this [bashew](https://github.com/pforret/bashew)\n* Bash documentation from [Google](https://google.github.io/styleguide/shellguide.html), [BashPitfalls](https://mywiki.wooledge.org/BashPitfalls), [Microsoft](https://github.com/microsoft/code-with-engineering-playbook/blob/master/code-reviews/recipes/Bash.md)\n\n## 🤔 What's that name? Bashew?\n* derived from 'bash new'\n* rhymes with cashew\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/pforret/bashew.svg)](https://starchart.cc/pforret/bashew)\n","funding_links":[],"categories":["bash","Shell","Shell Script Development"],"sub_categories":["Directory Navigation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpforret%2Fbashew","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpforret%2Fbashew","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpforret%2Fbashew/lists"}