Skip to content

potherca-bash/includes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Potherca BASH -- Includes

project-stage-shield license-shield Maintained Potherca standard-readme compliant

Non-code building blocks for BASH scripts.

This repository contains files that hold comments, declarations or other common non-code lines often used in (my) BASH scripts. Instead of copy/pasting these lines, this repository offers a way of installing them as a dependecy (using BPKG). They can then be included from BASH scripts using source.

They are meant to serve as building blocks for BASH scripts.

Background

When creating BASH script, I found myself copy/pasting certain lines of comment or code over and over. It seemed more sensible to separate those lines into separate files and just include the files from other scripts. This repository is part of that effort. Others can be found at https://github.com/potherca-bash/.

Install

This repository can be installed in several ways:

  • Using bpkg
  • Cloning the repository
  • Downloading the archive for a given release

Using bpkg

Available as a bpkg package:

bpkg install 'potherca-bash/includes'

This will install all available files in the deps/ directory of the project that bpkg has been run in.

Cloning the repository

git clone 'git@github.com:potherca-bash/includes.git'

Downloading the archive

The latest release will always be tagged latests. To download the latest archive:

  curl -L -o 'includes.tar.gz' 'https://github.com/potherca-bash/includes/archive/latest.tar.gz'
  tar -xvzf 'includes.tar.gz'

Usage

Simply include a file using source:

#!/usr/bin/env bash


source './deps/includes/src/declare/declare.bash-options.inc'
source './deps/includes/src/comment/license/comment.license-mpl2.inc'
source './deps/includes/src/declare/declare.color.inc'
source './deps/includes/src/declare/declare.exit-codes.inc'

# ...
# Script logic goes here
# ...

This works best when used during development, for production it is advisable to compile a version from the script that replaces the source entries with the content of the included file(s), for instance using inline-source.

Contributing

Issues can be reported at https://github.com/potherca-bash/includes/issues.

Pull/Merge-request are welcomed.

To make code changes, fork this repository and install the needed dependencies:

cd './includes'
bpkg getdeps

License

This project is licensed under a MPL-2.0 License, Created by Potherca