Git Product home page Git Product logo

bahelite's Introduction

Bahelite

Bash helper library – to everyone!

  • bahelite.sh provides

    • A check for the bash version.
    • A check for sourced script.
    • MYNAME, MYDIR, MYPATH, CMDLINE, ARGS
    • Functions to temporarily disable xtrace, errexit (with a trap on ERR) and noglob.
    • check_required_utils to make sure all binaries are available.
  • bahelite_colours.sh provides variables to control the colour, boldness/brightness and background.

  • bahelite_error_handling.sh

    • sets a trap on ERR, where it prints call stack trace, the command on which script has failed and its exit code. Calls a user’s hook, if it exists.
    • sets a trap on EXIT, TERM, INT, QUIT and KILL, where it removes TMPDIR. Calls a user’s hook, if it exists.
    • sets a trap on DEBUG for better error catching: now bahelite traps catch “unbound variable” errors, for example.
  • bahelite_logging.sh

    • creates a directory named after the main script – the one that calls bahelite.sh – and writes a copy of all stderr and stdout in a file there. Keeps last five logs by default.
    • defines a function to print the path to the log file to the user.
  • bahelite_menus.sh

    • defines user-friendly, arrow-key-controlled menu functions. Selection never was this easy and fool-proof before.
  • bahelite_messages.sh

    • Pretty output
      • All messages are multiline by default: excess spaces on the lines next to the first are cut.
      • Messages may have their own indentation level, which is kept even.
      • Highlighing is moderate with only a coloured asterisk by default. It is possible to highlight the whole message and print the message type instead of an asterisk, that is INFO:, WARNING: or ERROR: for example.
    • Function sets
      • info function set: to print informational messages. infon doesn’t print a newline, (like echo -n), infow will run a command, and then print either [ OK ] or [ Fail ] depending on its status.
      • warn function set: for the warnings, always sent to stderr.
      • err: for the errors, automatically quits the program.
    • Desktop notifications
      • If not needed, can be disabled with setting NO_DESKTOP_NOTIFICATIONS to any value.
      • By default err sends a copy of the message to desktop.
      • info and warn – only when called as info-ns and warn-ns (-ns stands for notify-send).
    • Keyworded messages and localisation files are possible.
  • bahelite_misc.sh

    • if_true reads a variable name and returns 0 or 1, depending on the variable contents: 0 is for y/Y/yes/Yes/on/On/enabled/Enabled/1/t/T/true/True and 1 for their counterparts.
    • dumpvar takes multiple variable names, passes them to declare -p and prettifies the output with msg function.
  • bahelite_versioning.sh

    • update_version is a function to be used in a pre-commit hook to update the version in a specified variable in a specified file. Works with three-number X.Y.Z versions only, four-number ones like A.B.C.D are not supported.
    • compare_versions will print the biggest of the two passed versions, or equal, if they are equivalent.
  • bahelite_github.sh

    • New function there will check, if a github repo got a new release. Can check for updates at a given interval.

bahelite's People

Contributors

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