Code Monkey home page Code Monkey logo

hon's Introduction

Hon

Multi Level Bash Scripts

Build Status Dependency Status npm version

Why?

Bash scripts are widely used to collapse multi-step processes into a single step, but a lot of times they can get not-so-readable:

npm run build
zip dist.zip dist/ -r
scp dist.zip chimera:/tmp
ssh chimera "cd /tmp; unzip dist.zip; cp dist/* /var/www/nihey.org/; rm dist.zip dist/ -r;"
rm dist.zip

Hon solves that by allowing you to code multi level scripts:

npm run build
zip dist.zip dist/ -r
scp dist.zip chimera:/tmp
ssh chimera
    cd /tmp
    unzip dist.zip
    cp dist/* /var/www/nihey.org/
    rm dist.zip dist/ -r
rm dist.zip

It makes it easier to code in other languages inside a bash script too:

ssh chimera
    python
        print 'It really works'
    node
        console.log("I can even read arguments: $1")
python
    print 'Awesome!'

Installation

$ npm i -g hon

Usage

  Multi Level Bash Scripts

  Usage
    hon [options] <file> [...args]

  Options:
    -b, --bash      just show the equivalent bash script
    -q, --quiet     do not show stdout and stderr

You just need to create your script:

# script.hon

ssh nitrogen
    cd /var/www/nihey.org
    git fetch
    git rebase
    sed -itmp -e "s/FOO/BAR/g" config.file
    sudo supervisorctl restart my_service

Then just run the script:

$ hon script.hon

License

This code is released under CC0 (Public Domain)

hon's People

Contributors

nihey avatar

Watchers

 avatar  avatar  avatar

hon's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.