~pi/aka

f62ee3266d3bfc99f64ebd3d2b4815d2a77e9f81 — Paul Ivanov 1 year, 1 month ago 97da1d5
pretty sweet
2 files changed, 25 insertions(+), 16 deletions(-)

M README
M aka
M README => README +19 -12
@@ 1,22 1,29 @@
# Also Known As

A simply "launcher" of command-subcommand style where the the subcommands can
be altered based on configuration
A simple "launcher" of command-subcommand style where the the subcommands can
be altered based on configuration.

    $ aka alias pager more

    $ aka pager --version
    more from util-linux 2.36
    $ aka alias pager less

    $ aka alias pager git

    $ aka pager --version
    less 551 (GNU regular expressions)
    Copyright (C) 1984-2019  Mark Nudelman
    
    less comes with NO WARRANTY, to the extent permitted by law.
    For information about the terms of redistribution,
    see the file named README in the less distribution.
    Home page: http://www.greenwoodsoftware.com/less
    git version 2.28.0

## Notes

Initial prototype uses aliases, which won't work for programs that depending on
establishing their behavior based on the `argv[0]` name they were called by.
Initial prototype uses aliases, which may not work for programs that depend on
establishing their behavior based on the `argv[0]` name they were called by
(busybox, for example).

We use an .aka file in the current directory for storing the aliases.

## Ideas

[ ] AKA_HOME environment variable to look for .aka (so we don't always look for
    .aka in either PWD or HOME)

[ ] `aka unalias` command

M aka => aka +6 -4
@@ 1,6 1,6 @@
#!/bin/sh

# is this a alias creation? that means we should have at least 3 arguments,
# Is this an alias creation? If so, we should have at least 3 arguments,
# such as:
#
# $ aka alias pager more


@@ 21,9 21,11 @@ if [ $# -ge 3 ]  && [ $1 = alias ] ; then
fi

if [ -e .aka ] ; then
    echo sourcing .aka;
    # TODO - wrap this in if-VERBOSE
    #echo sourcing .aka;
    . ./.aka
fi

# TODO - wrap this in if VERBOSE
echo `type $1`
# TODO - wrap this in if-VERBOSE
#echo `type $1`
eval $*