kyleburton / bake

Pure bash, very lightweight scripting and build framework.
29 stars 8 forks source link

Support Aliasing bake tasks #31

Open ischaaf opened 5 years ago

ischaaf commented 5 years ago

Overview

Added a new function bake_task_alias to be used alongside or in place of bake_task. bake_task_alias works similarly to bake_task except that it accepts an additional argument indicating the name of the bash function to call for this task.

bake_task name [description]
# vs
bake_task_alias name function_name [description]

The key functionality here allows for creating tasks in which the task name and function name differ.

# from sandbox/Bakefile
function run.my.program () {
  echo "lets run the program! $*"
}

# Alias the "run.my.program" function to "run"
bake_task_alias run run.my.program "Run the program [alias]"

This will generate the following task list

> ../bake

../bake task [arg ...]

  run                            Run the program [alias]

> ../bake run
lets run the program!