Giter Site home page Giter Site logo

bashplate's Introduction

bashplate

Rationale

OK, here's the thing. I don't want to repeat myself in Bash, but I keep using the same damn functions all the time! There are lots of frameworks on GitHub which aim to fix this problem, but they have a habit of being absolute monsters in terms of size -- if I need a script to be over 100 lines I usually move to Python. So I need some way to stop myself writing/auto-generating the same generic logging, usage & options code.

Features

Enter bashplate -- a single file you can source to make life easier when writing shell scripts. It really does hardly anything:

  • Some logging, error functions
  • Usage handling (send to stderr on failure)
  • Long options with POSIX correctness (!!!) thanks to getopts_long

Seriously it's just barely over 50 lines (as of 2016-08-25). Commented fully etc.

Usage

  • Point $_BASHPLATE_DIR to wherever you choose to install bashplate (I use ~/.local/share/bashplate).
  • Source $_BASHPLATE_DIR/bashplate.sh.
  • Define $_usage as a full usage string (e.g. Usage: $_FILENAME [options]).

The $_FILENAME variable is provided as the name of the script being called.

License

getopts_long.sh is provided under the license stated in its file (IANAL but it's a short MIT license). All other files in this repository are provided under the MIT license (see LICENSE).

bashplate's People

Contributors

raehik avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.