Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A simple way to wrap a system command and add or enhance functionality
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ls
svn
README
init

README

A simple way to wrap a system command and add or enhance functionality, Requiring minimal setup and using a clear and simple directory structure to add scripts.

This is a work in progress, and the example commands are just that, not meant for production.

== Install ==

To setup add <INSTALL PATH>/init to your bash init. 

== How does this work? ==

It's best to look at the code for now. Or ask me. I'll write a better explanation later.

The init script creates an alias for each sub-directory mapped to a script of the same name, eg svn/svn or ls/ls.

In the current examples: ls is a single script wrapped around the native ls command, passing on all original arguments. You could, for example, log all ls path calls to a file ala bash history.

svn is a more complex example where the main script (svn/svn) delegates based on the sub-command, if a script of the same name exists (eg, "svn help" would map to svn/help) then it's called, otherwise the native sub command is called. The delegated script can then either implement new functionality or wrap native. 

I need to define some better terminology to make this clearer.

=== Types of adaptor ===

Command adaptor: Wraps a single command, like "ls", allowing you to add new options or add to output.

Sub-command adaptor: Wraps a command with sub-commands, such as svn, allowing you to add new sub-commands locally.

== Warning ==

This is still a work in progress and needs some more re-factoring before it's ready for anyone else to use properly. Mostly making the delegation in svn/svn generic and not required in each script.

You should only add, never change, existing command functionality. Otherwise you'll likely break things relying on normal unix behavior. Don't be a dick.
Something went wrong with that request. Please try again.