Skip to content

tomocafe/bash-boost

Repository files navigation

bash-boost

bash-boost is a set of library functions for bash, useful for both scripting and interactive use. It draws inspiration from the Boost C++ libraries.

Philosophy

  • Prefer pure-bash solutions
  • Don't reimplement existing bash features, complement them
  • Functions should have a single purpose, without complicated options
  • Avoid cluttering the user's environment

For examples and further details, see CONTRIBUTING.md

Requirements

bash version 4.2 or later.

This has only been tested for Linux. YMMV for other platforms.

Installation

From release tarball (recommended)

Download and extract the latest release, then follow the instructions in the Usage section.

From git

Clone this repository and run make. For manual generation, perl and pandoc are required.

Usage

Source the bash-boost.sh script and use bb_load to load modules and/or packages

source /path/to/bash-boost.sh

bb_load MODULE      # e.g. cli
bb_load MODULE/PKG  # e.g. cli/arg

Alternatively, you can list modules and packages to load by argument when sourcing bash-boost.sh:

source /path/to/bash-boost.sh MODULE MODULE/PKG ...

If you want to distribute bash-boost as a single file, you can use bash-boost-portable.sh and all modules and packages will be available for use. Please use proper attribution if distributing bash-boost. See LICENSE for details.

source /path/to/bash-boost-portable.sh

Organization

bash-boost consists of the following modules, each with different packages

  • cli - for command-line (script) use
    • arg - for parsing command line arguments
    • color - for printing text in color
    • input - for handling user input
    • msg - for messaging and logging
    • progress - for creating progress bars
  • interactive - for interactive use
    • cmd - miscellaneous interactive commands
    • prompt - dynamic shell prompt
    • bookmark - directory bookmarking system
  • util - general purpose routines
    • env - for checking and setting environment variables
    • file - file and filesystem related operations
    • kwargs - for handling keyword arguments
    • list - common list operations
    • math - common math operations
    • prof - runtime profiling routines
    • string - common string operations
    • time - common time and date operations

You have the choice of loading an entire module, or select certain packages from them.

Documentation

See the manual for an exhaustive list of functions defined in each package.

Versioning

This project follows semantic versioning. Any breaking changes must be made in a new major release. New functions are introduced in minor releases. Patch releases only include fixes to existing functions. No documented feature should be regressed in a minor or patch release.

Alternatives

There are a number of different bash libraries out there, including:

About

bash-boost is a set of library functions for bash, useful for both scripting and interactive use. It draws inspiration from the Boost C++ libraries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published