Command line laziness redefined! This module is language agonistic. It can store any command line statement as shortcuts!
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
CONTRIBUTING.md
lazyboy.js
package.json
readme.md

readme.md

lazyboy NPM version Bitdeli Badge

NPM

> Command line laziness redefined!

The sole purpose of lazyboy (a.k.a lb) is to make you more lazier when dealing with CLI. How many times did you type got init instead of git init and the "smart" CLI corrects you!

But what if you had a shortcut say i to run git init everytime?? would'nt that be convinent?

So, here is a CLI that does exatcly the same for you!!

Contents

Installation

Install the module globally :

$ npm install -g lazyboy

Options

Usage: lb [options]

Options:

    -h, --help                       output usage information
    -V, --version                    output the version number
    -a, --add [command -> shortcut]  Enter a command that you would like to shortcut.
    -r, --remove [shortcut]          Enter the shortcut to be removed from the saved commands.
    -x, --execute [shortcut]         Enter the shortcut to run the saved command.
    -p, --print                      Prints the list of saved shortcuts
    -i, --import [commands]          Imports the commands that was exported from another Lazyboy collection
    -e, --export                     Exports all the commands in your Lazyboy collection

  Example Usage:

  > Add new command and its shortcut
    $ lb -a "git init -> gi"
  > Execute a shortcut
    $ lb -x "gi"
  > Print saved shortcuts
    $ lb -p
  > Remove a shortcut
    $ lb -r "gi"
  > Export your Lazyboy shortcuts
    $ lb -e
  > import Lazyboy shortcuts
    $ lb -i '[{"command":"git init","shortcut":"gi"},{"command":"ls -ltr","shortcut":"l"}]'

Documentation

Adding and Executing shortcuts

You can add a new shortcut by running

$ lb -a "git init -> i"

do notice the ->. The left hand side of -> is the command and the right hand side part is the shortcut.

PS : You can name your shortcut charcters, numbers, etc..

Now, you can execute the command by running

$ lb -x i

or

$ lb i

Simple right??

Another example. Do you use the Python's SimpleHTTPServer module to launch a new static server? And you have to type

$ python -m SimpleHTTPServer

or

$ python -m http.server

You can create an alias like

$ lb -a "python -m SimpleHTTPServer -> ps"

and you can run the below command in the folder where you want to spwan the HTTP server

$ lb -x ps

or

$ lb ps

Sweet right? And the best thing is, this module is language agonistic. It can store any command line statement as shortcuts!

You can also add dynamic commands like

$ lb -a "git commit -m * -> c"

here * is the placeholder. And you can execute the command like

$ lb -x c "Initial Commit"

or

$ lb c "Initial Commit"

This will run git commit -m "Initial Commit" for you.

And if you are like me creating new repos and pushing them to Github, you must have this shortcut

$ lb -a "git init && git add -A && git commit -m * && git remote add origin * && git push origin master -> r"

And then the next time when you want to initialize and push the current folder to Github all you need to do is

 $ lb r "inital commit" "https://github.com/arvindr21/lb.git"

And bam!!! You code will be initialized, staged, commited locally and pushed to Github!

PS : The order of arguments in the actual command should match with the arguments while using lazyboy

Prinitng shortcuts

Running

 $ lb -p

will list all the shortcuts you have saved so far

List of saved commands :

    Shortcut    Command
    i    git init
    r    git init && git add -A && git commit -m * && git remote add origin * && git push origin master

Removing shortcuts

If you want to remove any shortcuts, you can run

$ lb -r i

where i is the name of the shortcut.

Importing & Exporting shortcuts

You can export your saved shortcuts and then share them with your near and dear ones! All you need to do is run

$ lb -e

And you can share the output

$ lb -e
[{"command":"git init","shortcut":"i"},{"command":"git init && git add -A && git commit -m * && git remote add origin * && git push origin master","shortcut":"r"}]

And you can import the same using

$ lb -i '[{"command":"git init","shortcut":"i"},{"command":"git init && git add -A && git commit -m * && git remote add origin * && git push origin master","shortcut":"r"}]'

Do notice the single quotes before and after the JSON.

Contributing

See the CONTRIBUTING Guidelines

License

Copyright (c) 2014 Arvind Ravulavaru. Licensed under the MIT license.