Git Product home page Git Product logo

docopt-scripts's Introduction

docopt-scripts

This tool provides a framework for invoking a collection of bash scripts through a single command line interface. Its purpose is to ease the development of these scripts with well-formed usage semantics from docopt and collect them into a single place for easy access.

The tool itself can be built into an executable with a name of your choice, and individual scripts are invoked as subcommands of that executable. For example, if you build the tool to have the name ak, then a script called launch-qemu can be invoked as follows:

$ ak launch-qemu

Individual scripts can be spread across the file system and the tool will coalesce them based on the value of an $<EXEC>_SCRIPTS_PATH environment variable (e.g. $AK_SCRIPTS_PATH). This environment variable (as well as any others) can be set in a special .<exec>config file in the users home directory (e.g. ~/.akconfig). Putting variables in this file (as opposed to your standard ~/.bashrc keeps them from being set on a system wide basis and only available during the running of this tool.

Scripts are written with the following naming convention so that they can sit along other files in the $<exec>_SCRIPTS_PATH:

<exec>-<script_name>.sh

When invoked, they are called as:

$ <exec> <script_name>

Instructions on how to write these scripts is forthcoming. For a (very) simple example, see the print-scripts-path.sh script in the scripts folder of the repo.

Installation

This installation requires Go >= 1.5.0. As part of this, Go requires you to set the value of the GOPATH environment variable in order to download and install third party packages during go compilation. Your GOPATH should remain set so that installed scripts can make use of Go as well. Please add the following to your .bashrc file (or equivalent).

export GOPATH=<path_to_third_party_go_stuff>
export PATH=${GOPATH//://bin:}/bin:$PATH

For reference: https://github.com/golang/go/wiki/GOPATH

After that, just...

  1. Clone the repo
  2. Run make EXEC=<exec> install
  3. Follow the onscreen instructions

Contributing

See CONTRIBUTING.md for details.

This is not an official Google product

docopt-scripts's People

Contributors

klueska avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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