Home

Awesome

aka

aka is a simple, single-file-executable command-line tool which lets you define per directory config files as aliases for shell commands.

LuaRocks version Build Status Code Coverage License: GPL v3

Motivation

Being an avid user of Linux' alias command, oftentimes I found myself frustrated with a couple of "more advanced" use-cases and wanted a really simple tool which would:

Features

Usage

<a href="https://asciinema.org/a/215736?autoplay=1" target="_blank"><img src="https://asciinema.org/a/215736.svg" /></a>


Overview

Using aka is quite straightforward:

Configuration File

Configuration files are actually Lua files which means we're using:

Here is an example of a configuration file to get started with:

-- regular aliases
pwd_alias = 'pwd' -- usage: aka pwd_alias
du_alias = 'du -h' -- usage: aka du_alias

-- nested aliases
alias_group = {
  alias_subgroup = {
    list = 'ls -alh' -- usage: aka alias_group alias_subgroup list
  }
}

A more practical example could be:

-- example project's docker containers management commands
docker = {
  bash = {
    django = 'docker exec -i -t $(docker ps -f name=django --format "{{.Names}}") /bin/bash',
    postgres = 'docker exec -i -t $(docker ps -f name=postgres --format "{{.Names}}") /bin/bash'
  },
  build = {
    django = 'docker-compose -f local.yml up --build django',
    postgres = 'docker-compose -f local.yml up --build postgres',
    all = 'docker-compose -f local.yml up --build'
  }
}

In the example above we'd be able to use namespaced aliases like this:

Command Line Interface

aka - per directory shell aliases

Usage:
  aka alias [sub_alias sub_sub_alias ...]
  aka -l|--list
  aka -h|--help

Options:
  -l, --list        List all aliases
  -h, --help        Print usage

Installation

Use Pre-compiled Binary

Overview

The goal from the start was for this tool to be easily distributable across Linux machines (not having to have Lua on your system to be able to use aka).

With this in mind and the fact that Lua is small, pre-compiled x86_64 linux binaries are available for download which contain the entire LuaJIT compiler and aka source code.

Download

https://github.com/bonidjukic/aka/releases/latest

Using LuaRocks To Install

To install aka using luarocks package manager, run this command in your terminal:

luarocks install aka

If you don't have LuaRocks installed, this document can guide you through the process.

Building From Source

Prerequisites

Building aka from source is possible, but at the moment, luastatic command line tool is a prerequisite for the build process.

luastatic is used to build a standalone executable from a Lua source code.

Building

To build aka run:

make or make build

Installing

To install aka run:

make install

Uninstalling

To uninstall aka run:

make uninstall

Testing

Prerequisites

Busted unit testing framework is required to run the tests.

Running The Tests

Navigate to aka project's root directory and run:

busted

Roadmap

There are a couple of features I'm planning to add in the near future:

Nomenclature

If it's not obvious, aka was named after the acronym of the Also known as adverb, i.e. a.k.a which is a synonym of alias and also has a nice side effect of being very short to type.

Versioning

SemVer is used for versioning. For the versions available, see the tags on this repository.

Changelog

The format is based on Keep a Changelog — please see the CHANGELOG.md for a detailed list of changes.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details.