Gumba provides modern language features to your everyday shell scripting
Last updated 7 years ago by welldan97 .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install gumba 
SYNC missed versions from official npm registry.


Build Status

Gumba likes to live between your shell pipes. When writing scripts is too much hassle and writing shell function is too much magic you use Gumba.


Make sure you have Node.js & npm installed. You can install Gumba using npm command:

npm install -g coffee-script

Also if you are going to using to use it frequently and I hope so, add a shorthand to your shell init file:

alias u='gumba'


With gumba you can use coffescript language powered by underscore & underscore.string inside your command line. Think of Gumba as a kind of awk or sed.

Look at following examples:

First Example:

before Gumba:

echo '  IdentityFile "file_path"' | cut -d ' ' -f4 | tr -d '"'

after Gumba:

echo '  IdentityFile "file_path"' | u 'clean().words().last().trim("\"")'

Both return file_path. So basically cut -d ' ' -f4 | tr -d becomes u 'clean().words().last().trim("\"")'. Although first is not so bad, the second still feels cleaner and easier to remember. This is a real world example, after which I decided to make Gumba.

Second Example — Sed replacement:

Another real world example comes from the question on StackOverflow — (How to trim whitespace?)[]

before Gumba:

echo ' test test test ' | sed -e 's/^ *//g' -e 's/ *$//g'


after Gumba:

echo ' test test test ' | u 'trim()'

More Examples:

Gumba uses just coffeescript so you can make regex replaces easily using standard javascript functions:

echo "['bulbasaur' 'chermander' 'pikachu'];" |
u "trim('[];')\                                             # -> 'bulbasaur' 'chermander' 'pikachu'
.replace(/'.*?'/g, (match) -> match.trim('\'').humanize())\ # -> Bulbasaur Chermander Pikachu
.words().toSentence()"                                      # -> Bulbasaur, Chermander and Pikachu

Gumba provides take function which provides you ability to use javascript in more flexible way using line object as it's argument:

echo hi | u 'take (line) -> "#{line.toUpperCase()}!"' # -> HI!

Supported methods

Gumba extends standard javascript object prototype with underscore & underscore.string functions. For example on String object you can use either underscore.string, underscore object or default javascript methods:

"Hello World"
  .toUpperCase() # standard javascript
  .capitalize()  # underscore.string
  .isString()    # underscore

To have a look on underscore methods reference go here, for underscore.string — here

Function evaluation

Every time you pipe to gumba it evaluates function passed as argument passed to to each line of piped stream:

echo "Hello World" | u 'toUpperCase().take (line) -> "#{line}!"'

converts to javascript

    return line + "!";


Fork, Pull, Post Issues.

I would love to get any help in project cultivation.


Current Tags

  • 1.0.1                                ...           latest (7 years ago)

2 Versions

  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (2)
Dependents (0)

Copyright 2014 - 2017 © |