ergonomica

A Bash alternative written in Python.

Follow me on GitHub

Ergonomica

A cross-platform modern shell.

Why use ergonomica?

Ergonomica is a cross-platform shell language, implemented in Python. Ergonomica aims to modernize the terminal, in an easily-extensible and usable language, independent of the OS on which it runs. It uses existing core utilities such as the os and shutil packages, as well as other utilities written in Python, such as the pyvim editor, providing built-in tools that are not os-dependent. Existing Python language features such as asynchronous returning may replace components of the shell such as piping.

Examples

Ergonomica is simultaneously adherent to POSIX-like argument standards, lisp S-expressions, and Python readability and whitespace. So, to list the files in the current directory, do

ls

You can then define functions using the def keyword, like so

def list-your-home
   ls ~

And then any calls to list-your-home will list the files in your home directory. Note that Ergonomica is lazy-evaluated, so if a call is made to some function in another function, if the called function is changed, the behaviour of the outer function also changes. Ergonomica realizes that piping is a useful feature of the shell in terms of ease of use and speed. Thus, pipes are available in Ergonomica. Ergonomica’s map function provides a very easy to use interface for these streams, with str.format-style argument placeholders. For example,

print a a.txt b b.txt | map mv {0} {1}

would move a to a.txt and b to b.txt. Piping and the map function, turns out, are really useful for larger scripts. Take warp-dir, a Bash script to provide aliases for cding into directories. In Ergonomica, the implementation of a similar script would look something like this:

def warp_list
    cat ~/.ergo/.wp | map split "->" | map print {0}

def warp-filter
    if eq {0}

def warp NAME
    cat ~/.ergo/.wp | map split "->" | map if (eq {0}) 

def create_warp NAME PATH
    print NAME "->" PATH | write ~/.ergo/.wp

def delete_warp NAME
    cat ~/.ergo/.wp | map split "->" | map (if (neq {0} $NAME) (print {0} "->" {1} | write ~/.ergo/.wp-new))
    mv ~/.ergo/.wp-new ~/.ergo/.wp

Authors

Liam Schumm (@lschumm), Lead Developer. Andy Merrill (@appleinventor14), Developer. Dhyan Patel (@dpp2000), Developer.

Support or Contact

Feel free to file issues at our github page.