Skip to content

ilya-bystrov/mk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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