Git Product home page Git Product logo

bang's Introduction

bang

An experimental test library for bash. Alternatively, a testing ground for me to push the limits of convoluted bash scripting.

Project layout

Directories

  • bin contains the bang entrypoint
  • examples contain code demonstrating the usage of bang
  • lib contains the modules that comprise bang's core functionality
    • exports contains modules defining functions that will be exposed to test code
  • privatebin contains internal entrypoints that are used to isolate test executions

Conventions

Files

There are two kinds of files containing bash code: executables and modules.

  • Executables are entrypoints that are intended to be called directly.

    • Executables must never be sourced.
    • Executables must contain as little code as possible. They should only perform some basic setup and then call out to a module function.
    • Executables names must not include an extension. (e.g. it's bang, not bang.sh)
  • Modules define the code that does the work.

    • Modules must never be called directly.
    • Modules must never have side effects until they are invoked.
    • Module filenames must end with .sh.

Modules

  • Each module's name should be one short word (e.g. assert, err).
  • To prevent collisions, all global names must be namedspaced.
    • Module-scope variables must be all-caps and prefixed with _BANG_ followed by an underscore-delimited list of module names.
      • Thus, if we want to declare a variable VAR in a module file at lib/foo/bar.sh, the actual variable name should be _BANG_FOO_BAR_VAR.
    • Function names must be prefixed with bang:: followed by a list of module names delimited by ::.
      • Thus, if we want to declare a function func in lib/foo/bar.sh, our function must be named bang::foo::bar::func.

bang's People

Contributors

pushittoprod avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.