Giter VIP home page Giter VIP logo

triqui's Introduction

Triqui

Edgar Gonzàlez i Pellicer, 2010-2016

triqui is a tool for bash which simplifies the management of environment variables associated to software installed in non-standard locations (e.g., in user directories instead of system-wide ones).

It is based on the notion of modules, which can be individually loaded and unloaded, as well as depend on others. Reference counting ensures dependencies are loaded automatically and unloaded when it is safe to do so.

Installation

  1. Download the triqui.bash file and place it in the ~/.triqui folder.

  2. Append the following to the ~/.bash_profile, ~/.bash_login or ~/.bashrc file, as needed.

    source ~/.triqui/triqui.bash
    
  3. Add .tri files to the ~/.triqui folder for each module.

.tri Files

Each .tri file in the ~/.triqui folder specifies one module.

Their format is line-based, with each line specifying one directive. Empty lines, and those starting with a # sign are ignored. So do those that contain an unknown directive, although after generating a warning.

The values of directives are subject to shell expansion.

Directives

  • <name> = <value>

    Exports the environment variable <name> with <value> as its expansion. Since values are subject to shell expansion, the <name> can be used (as ${NAME}) in other directives.

  • ACLOCAL <path>

    Appends <path> to the ACLOCAL_PATH variable, allowing aclocal to search for .m4 files there.

  • ALIAS <name> = <value>

    Adds <name> as an alias with <value> as its expansion.

  • BIN <path>

    Appends <path> to the PATH variable, enabling it for program search.

  • -BIN <path>

    Equivalent to BIN, but it prepends <path> to PATH.

  • INCLUDE <path>

    Appends -I<path> to the CPPFLAGS variable, allowing cpp to search for #include files there.

  • INFO <path>

    Appends <path> to the INFOPATH variable, allowing info to search for .info files there.

  • LIB <path>

    Appends -L<path> to the LDFLAGS variable and <path> to the LD_LIBRARY_PATH one, respectively allowing ld to search for libraries there and those same libraries to be dynamically loaded when programs start.

  • -LIB <path>

    Equivalent to LIB, but it prepends <path> to the variables.

  • MAN <path>

    Appends <path> to the MANPATH variable, allowing man to search for pages there.

  • PERL5 <path>

    Appends <path> to the PERL5LIB variable, allowing perl to search for .pm modules there.

  • PKG-CONFIG <path>

    Appends <path> to the PKG_CONFIG_PATH variable, allowing pkg-config to search for .pc files there.

  • USE <module>

    Expresses a dependency on another <module>.

Commands

  • triqui ls

    List all available modules in the ~/.triqui folder.

  • triqui loaded

    List all currently loaded modules.

  • triqui info <module>

    Displays information about <module>. In particular, prints the different directives in a readable way.

    Note this is intended for human consumption. For automated processing, the raw .tri file is probably more convenient.

  • triqui load <module>

    Loads <module>. This applies the changes to the different environment variables as determined by the directives in the .tri file.

    If the module depends on another one through a USE directive, the latter's reference count will be increased. If this was the first reference to the module, it will also be automatically loaded.

  • triqui unload <module>

    Unload <module>. This undoes the changes to the variables that were done by triqui load.

    Note that this happens in a best-effort manner: the old values of the variables are not preserved when module loading happens, and instead they are reconstructed based on their current ones.

    If the module depends on another one though a USE directive, the latter's reference count will be decreased. If this was the last reference to the module, it will also be automatically unloaded.

  • triqui clear

    Unload all currently loaded modules.

The autoload file

If the ~/.triqui/autoload file exists, it is interpreted as containing one module name per line. These modules are automatically loaded when triqui.bash is sourced.

triqui's People

Contributors

edgar-gip avatar

Watchers

 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.