• Stars
    star
    235
  • Rank 165,025 (Top 4 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

bash script micro-framework - from small stand-alone script to complex projects with CI/CD and testing

Shellcheck CI bash_unit CI version version

Part of part of Bashful Scripting network network / Install with basher install

bashew.sh

Bashew Logo

bash script / project creator

⏳ TL;DR

to create a new stand-alone SCRIPT (just a xyz.sh script), with option parsing, color output (cf 1.)

    bashew.sh script

to create a new standalone script PROJECT (in a folder, with README) (cf 2.)

    bashew.sh project

to initialize a bashew-based REPO with CI/CD you just cloned (cf 3.)

    bashew init

🎯 Features

Self-contained

  • all code contained in 1 single file (no external dependencies)
  • comes with README.md, CHANGELOG.md, ... markdown files
  • edit only Script:main() function and subroutines in beginning of script, all template code is at the end of the script

Option parsing

  • definition of flags/options/parameters in 1 place only
  • automatic creation of usage text based on definition above
  • short/long option parsing, based on definition above
  • option --lorem [value] is available inside the script as $lorem
  • IO: functions for IO, with intelligent color usage (not when output is piped) (e.g. IO.success, IO.die)
  • Str: functions for string manipulation (e.g Str:lower, Str:digest)
  • Os: functions for e.g. required program checking (e.g. Os:require convert imagemagick)
  • read multiple .env configuration files
  • predefined --quiet (no output) and --verbose (more output) modes
  • folder for temporary files (with automatic cleanup)
  • folder for log files (with automatic cleanup)
  • correct determination of script installation folder (resolve symbolic links)
  • easy CI/CD for Github (with shellcheck)

πŸ”₯ Usage

Program: bashew 1.18.2 by [email protected]
Updated: May  1 16:49:18 2022
Description: package_description
Usage: bashew [-h] [-q] [-v] [-f] [-l <log_dir>] [-t <tmp_dir>] [-n <name>] <action>
Flags, options and parameters:
    -h|--help        : [flag] show usage [default: off]
    -q|--quiet       : [flag] no output [default: off]
    -v|--verbose     : [flag] output more [default: off]
    -f|--force       : [flag] do not ask for confirmation (always yes) [default: off]
    -l|--log_dir <?> : [option] folder for debug files   [default: /Users/pforret/log/bashew]
    -t|--tmp_dir <?> : [option] folder for temp files  [default: /tmp/bashew]
    -n|--name <?>    : [option] name of new script or project
    <action>         : [parameter] action to perform: script/project/init/update

1. create new bash script (without repo)

bashew.sh script                    # will interactively ask for author & script details
bashew.sh -f script                 # will create new script with random name
bashew.sh -f -n "../list.sh" script # will create new script ../list.sh

Example:

$ bashew script
⏳  1. first we need the information of the author
Author full name         (pforret) > Peter Forret
Author email             ([email protected]) > 
Author (github) username (pforret) > 
⏳  2. now we need the path and name of this new script/repo
Script name (./bespoke_bunny.sh) > 
⏳  3. give some description of what the script should do
Script description (This is my script bespoke_bunny) > process log files
⏳  Creating script ./bespoke_bunny.sh ...
./bespoke_bunny.sh

$ bashew -f script 
⏳  Creating script ./mediums_appease.sh ...
./mediums_appease.sh

2. create new bash project folder/repo (with README.md, CI/CD)

$ bashew project               # will interactively ask for author & script details
or
$ bashew -f project            # will create new project with random name
or
$ bashew -f -n "tango" project # will create new project in folder "tango"

Example:

$ bashew -f project
⏳  Creating project ./bounden_brawled ...
CHANGELOG.md README.md VERSION.md LICENSE .gitignore .env.example bounden_brawled.sh bitbucket-pipelines .github  
βœ…  next step: 'cd ./bounden_brawled' and start scripting!

3. create a bash script repo, with CI/CD, with README, with tests, with versioning ...

$ git clone https://github.com/<you>/<your repo>.git
$ cd <your repo>
$ ./bashew.sh init             # will ask for details and initialise/clean up the repo

and then, if you have setver.sh:

$ setver push          # will commit and push new code
$ setver new patch     # will set new version to 0.0.1
$ setver set 1.0.0     # when your first working version is committed

4. git clone into new repo

$ git clone --depth=1 https://github.com/pforret/bashew.git <newname>
$ cd <newname>
$ ./bashew.sh init             # will ask for details and iniialise/clean up the repo

πŸš€ Installation

  • manually
$ git clone https://github.com/pforret/bashew.git
$ ln -s bashew/bashew.sh /usr/local/bin
  • or with basher package manager basher install
$ basher install pforret/bashew

πŸ¦ͺ Built with Bashew

  • bumpkeys: upgrade your SSH keys for better security
  • crontask: call scripts or URLs from a crontab file, with optional logging and webhook upon success/failure
  • jekyll_taxonomy: Generate tag and category pages for Jekyll static sites
  • m1_homebrew: Install homebrew in native mode on Apple MacOS ARM
  • mkdox: create and run Mkdocs Material websites using Docker image
  • netcheck: test network: interfaces, gateway, router, internet
  • note: Manage your notes, todo, ... with this nifty script
  • pa: like "php artisan" but more intelligent (use optimal PHP version for the project
  • progressbar: Easy, clever progress bar for (bash) scripts
  • rexec: repeat a command and be alerted when the output changes
  • saild: Start up your Laravel Sail dev setup in one go - Docker, Browser, Shell
  • screenshots: Let GitHub automatically make πŸ“Έ screenshots of all your websites
  • setver: Easy semver tool -- get/set git version (one-line superfast git commit)
  • shaml: Read YAML files inside bash scripts
  • shini: Read INI files inside bash scripts
  • shlaunch: Launch desktop/GUI apps from CLI (e.g. Chrome, PHPStorm, Photoshop ...)
  • shlorem: Lorem Ipsum generator for the command line
  • shmixcloud: download Mixcloud shows and add album art to m4a files
  • shoarma: Static Image Site Generator - make e.g. Jekyll posts from folder of images
  • shtext: Text manipulation in bash, by always using the fastest method
  • shwiki: Wikipedia CLI in bash
  • shwordle: Wordle-clone with variable # of letters and multiple languages
  • splashmark: download/create (unsplash/pixabay/replicate) pics and resize/add effects/add attribution/watermark
  • teams-cli: Send messages to MS Teams channels from CLI
  • xkcd: View a XKCD comic in your console/TTY

πŸ™ Acknowledgements

πŸ€” What's that name? Bashew?

  • derived from 'bash new'
  • rhymes with cashew

Stargazers over time

Stargazers over time

More Repositories

1

m1_homebrew

Install homebrew in native mode on Apple MacOS ARM (M1)
Shell
56
star
2

LearnBashQuickly

Learn Bash scripting in 27 minutes
31
star
3

crontask

Use to call scripts or URLs from a crontab file, with optional logging and webhook upon success/failure
Shell
24
star
4

setver

Easy semver tool -- get/set package version from git tags (Github/Bitbucket/Gitlab), composer.json (PHP), package.json (npm)
Shell
23
star
5

progressbar

Easy, clever progress bar for (bash) scripts
Shell
17
star
6

note

Manage your notes, todo, ... with this nifty script CLI/bash
Shell
8
star
7

m1fusion

Stable Diffusion install/uninstall/prompt for MacOS M1
Shell
8
star
8

splashmark

Download/create (unsplash/pixabay/replicate) pics and resize/add effects/add attribution/watermark/...
Shell
8
star
9

rexec

repeat a command and be alerted when the output changes
Shell
8
star
10

bumpkeys

Upgrade your SSH keys for better security
Shell
7
star
11

awk-boilerplate

A template script for larger AWK/GAWK projects
Awk
6
star
12

wp_cleanup

Script to clean up infected WordPress installations
Shell
6
star
13

remac

Change your MAC address to limit your trackability
Shell
5
star
14

font

Manage installed fonts from CLI (Linux/MacOS)
Shell
5
star
15

ghlookup

Get info on Github repositories via API in bash CLI
Shell
5
star
16

shlorem

Lorem Ipsum generator for the command line (pure bash)
Shell
5
star
17

shwordle

Wordle (bash/CLI) with variable # of letters and multiple languages
Shell
5
star
18

shmixcloud

Download Mixcloud shows and add album art to m4a files
Shell
5
star
19

WinAdmin

Windows Admin Tools
Batchfile
5
star
20

pfor_ffmpeg

FFMPEG tricks and examples
Shell
4
star
21

netcheck

test network: interfaces, gateway, router, internet (bash script)
Shell
4
star
22

shini

Bash/shell .INI parser
Shell
4
star
23

shtext

Text manipulation in bash, by always using the fastest method
Shell
4
star
24

gandi_deploy

bash script to work easily with gandi.net paas git deployment (bash)
Shell
4
star
25

mkdox

create and run Mkdocs Material websites using Docker image
Shell
4
star
26

postmarkit

Use Postmark API to send emails (CLI/bash) -- UNDER DEVELOPMENT
Shell
3
star
27

shlaunch

Launch desktop/GUI apps from CLI (e.g. Chrome, PHPStorm, Photoshop ...)
Shell
3
star
28

networkcheck

Linux network check script (sh/bash)
Shell
3
star
29

moviewatcher

analyze IMDB export updates
Shell
3
star
30

photobackup

Backup photos (Lightroom) to external disk/NAS
Shell
3
star
31

ffdashboard

Firefox dashboard showing URLs in a loop
Shell
3
star
32

bash_benchmarks

Benchmarks to test different methods for string, file, process manipulation, ...
Shell
3
star
33

m1_ssd_tbw

Measure SSD wear (Total Bytes Written) on MacOS M1 (ARM64) machines
Shell
3
star
34

shwiki

Wikipedia CLI in bash
Shell
3
star
35

ytaudio

Download audio (YouTube/ Soundcloud/ ...) and split into stems (voice, drums, bass, other)
Shell
3
star
36

Lightroom

3
star
37

m1_benchmark

Some benchmarks of MacOS M1 (Apple Silicon) - using ffmpeg and primitive: CPU centered
Shell
3
star
38

bashew_github_action

Use bashew for a Github Action
Shell
2
star
39

xkcd

View a XKCD comic in your console/TTY
Shell
2
star
40

screenshots

Let GitHub automatically make πŸ“Έ screenshots of all your websites
Shell
2
star
41

replicate-cli

Bash CLI for use with Replicate.com API
Shell
2
star
42

PaparazzoMark

Photo watermarking script (Windows CMD)
PHP
2
star
43

squaredforwork

Create image reveal videos with ffmpeg and primitive
Shell
2
star
44

saild

Start up your Laravel Sail dev setup in one go - Docker, Browser, Shell
Shell
2
star
45

wpharden

Harden your Wordpress installation (bash script)
Shell
2
star
46

estimator

PHP package to help with statistic estimation
PHP
2
star
47

pf_kijkwijzer

Look up Kijkwijzer/Cinecheck rating for movies
PHP
2
star
48

gitploy

Deploy website/app through git (both push from dev and pull to prod)
Shell
2
star
49

www.fwdvibe.com

Instant forwarding email lists
SCSS
2
star
50

pa

like "php artisan" but more intelligent (use optimal PHP version for the project)
Shell
2
star
51

pf_pageparser

Simple Regex HTML Page Parser in PHP
HTML
2
star
52

beanstalkd_winphp

Windows Command Line client for Beanstalkd, using PHP CLI, to make Windows CLI workers
PHP
1
star
53

shoarma

Static Image Site Generator - make e.g. Jekyll posts from folder of images
Shell
1
star
54

mrtgobot

Robot script for a full MRTG installation: takes care of index, updates and rsync
PHP
1
star
55

jekyll_template_blog

Template for Jekyll blog sites
CSS
1
star
56

linux_for_ukraine

Script to install a laptop with Ubuntu for Ukrainian users #RefugeesWelcome
Shell
1
star
57

php_outlook_signature

Create Outlook email signatures from HTML templates
PHP
1
star
58

jekyll_taxonomy

Generate tag and category pages for Jekyll static sites
Shell
1
star
59

PhPaparazzo

Collection of PHP libs/classes
PHP
1
star
60

bash_experiments

testing out some bash concepts: concurrency, arrays, ...
Shell
1
star
61

rpi_dashboard

Dashboard with rotating pages on Raspberry Pi
Shell
1
star
62

pforret

profile README
1
star
63

chronocleanup

PHP library for scanning an existing folder structure and moving file to a /YYYY/YYYY-MM-/... structure while deduplicating
PHP
1
star
64

jekyll.tangopaparazzo.com

https://www.tangopaparazzo.com
CSS
1
star
65

benchmark_ipinfo

Test and compare IP Info lookup APIs
Shell
1
star
66

blog.splashing

Jekyll Blog with Photos
Shell
1
star
67

digestif

Digestif helps you create unique unguessable URLs (PHP)
PHP
1
star
68

php_markdown_writer

Write Markdown documents
PHP
1
star
69

millionaire

What does it take to be a millionaire (Laravel)
JavaScript
1
star
70

phpTextCleaner

Clean names, movie titles, article titles
PHP
1
star
71

clisync

Backup to local disks/S3 cloud storage with daily/weekly/monthly (CLI bash) -- UNDER DEVELOPMENT
Shell
1
star
72

tesla.forret.com

Homepage for Tesla in-car screen
CSS
1
star
73

jekyll.forret.com

Jekyll source for https://blog.forret.com/
HTML
1
star
74

jekyll_template_photo

Jekyll template for photography/portfolio websites
SCSS
1
star
75

SunnySideUp

Get info from solar monitoring sites
HTML
1
star
76

phpMakeMovie

php wrapper around ffmpeg/imagemagick for making H.264/mpeg4/mpeg2 (HD) movies
1
star
77

shaml

Read YAML files inside bash scripts
Shell
1
star
78

siteshow

Display URL carousel in Raspberry Pi browser
Shell
1
star