ilya-bystrov / mk

Bash-based Automation Tool (inspired by Makefile)

Home Page:https://ilya-bystrov.github.io/posts/makeit/makeit%3D.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mk: Bash-based Automation Tool

Features

  • Bash as a language
  • Shared context
  • Target is defined as a bash function
  • Targets can depend on others
  • Multiple targets can be invoked
  • Autocompletion support

Demo

demo is outdated, acutal name is ``mk``, not ``makeit``

Getting Started

  1. Enable autocompletion
$ wget https://raw.githubusercontent.com/ilya-bystrov/mk/master/completions/mk_completions -O - >> ~/.bash_completion
$ wget https://raw.githubusercontent.com/ilya-bystrov/mk/master/completions/mk_alias -O - >> ~/.bash_completion
  1. Use template
$ wget https://raw.githubusercontent.com/ilya-bystrov/mk/master/mk
$ chmod u+x mk
$ mk <Tab>
bye hello
$ mk hello
Hello, World!
$ mk bye
bye-bye.
  1. Customize mk for your own needs

Concept

  • The key idea is iterating through arguments that corresponds to function names and invoking this functions
  • Use the template
    • By default
      • /usr/bin/env bash shebang
      • errexit, pipefail, nounset bash options
  • Or build your own

Example

docker-container-management

Requires docker installed

$ cd mk/examples/docker-container-management/mk
$ mk build  # build 'someimage' docker image based on 'busybox'
$ mk run    # run 'someimage' image inside 'somecontainer' container 
$ mk rm     # remove 'somecontainer' container 
$ mk rmi    # remove 'someimage' image 

Improvements

Feel free to suggest improvements

Motivation

Motivation is covered in my post

About

Bash-based Automation Tool (inspired by Makefile)

https://ilya-bystrov.github.io/posts/makeit/makeit%3D.html


Languages

Language:Shell 100.0%