Giter Club home page Giter Club logo

av-shell's Introduction

av-shell

Make your own domain specific shell (DSS) with av-shell, the power of a customized cli environment for your project cannot be understated.

This is a really handy tool to organize your scripts and repetitive tasks into one place. When you run 'av', it looks at $PWD and the recursively upward for a '.av' directory. So, in a way, this operates like git and other awesome cli tools but you can insert new commands at your leasure.

Contracts:

  • Every script should handle a '-h' argument and output a single line of documentation. This makes the 'help' look nice
  • Don't overwrite the builtins

Installing

You will need the latest golang. Not using npm anymore. Using oh-my-zsh style of putting it in your home directory under a dot-folder.

git clone --depth=1 https://github.com/sio2boss/av-shell ~/.av && zsh ~/.av/install  --silent

Using av with your project

In your project folder run this and answer the wizard question(s):

av init

Your project now has a domain specific shell, just run for interactive:

av

Looks like this:

Starting up with av

Or for non-interactive, where help can be replaced with any command:

av help

You will notice there are some docker things in there...make sure you have setup docker like in the Docker section below.

Try creating a new command from the builtin template with:

av new my_new_command

A default editor will be opened if your $EDITOR variable isn't set. Run the following to edit your scripts after they are created:

av edit

Have fun!

Oh-My-Zsh Plugin

The install script now detects oh-my-zsh and enables the av-shell plugin.

Docker Support

This is a plugin for av-shell that integrates docker with your project.

Dependencies

Need docker or Docker.app

Setup

Setup the folder you want to have your docker containers located in, e.x. "containers":

av> setpv containerdir containers

Now setup the repo you will push containers to. Could be dockerhub:

av> setpv repo somehostname:port

Operation

Under the "containers" directory, create a folder for each container you want to use where you can put your Dockerfile and a Runfile (more about the latter later). I've include an example directory in this repo for you to copy and use as you like. Av-docker adds the 'choose' command:

av> choose
? Which do you want? nginx
Using nginx as container for docker commands
av [nginx]> 

You will notice how your av-shell prompt has changed to include the selected container.

Now you can use normal docker commands but without typing docker and the container name each time.

We are going to use a special av feature to show one way domain specific shells kick ass...

holdhash on

Lets build the nginx container

build

For a custom container, you will certainly want to setup the Runfile with docker arguments like this:

-d -p 80:80 -v $(pwd)/../../log:/var/log/nginx

Now start the container with the 'run' command:

run

The command should output some huge hash value. The first 12 chars can always be found with a ps

ps

CONTAINER ID    IMAGE   COMMAND              CREATED           STATUS          PORTS                NAMES
e1526432ae2f    nginx   /usr/local/bin/run   31 seconds ago    Up 31 seconds   0.0.0.0:80->80/tcp   stupefied_morse

But lets stop it with that 'holdhash' feature

stop

And start it back up again

start

Handy right? Well what if we what to shell into that container? av will help you here (need docker 1.3+)

shell

Lets shut it down

stop

And perminantly remove it

rmc

How many times did you not have to type docker? Make your life easy with av-docker!

example flow to push container:

tag latest
push latest

Releasing

Update config/version and run the package script like this:

bash package `cat config/version`

Go here https://github.com/sio2boss/av-shell/releases/new and make release

av-shell's People

Contributors

lapolonio avatar sio2boss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

lapolonio bioduck

av-shell'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.