Bodega
😉 A gorgeous, feature-packed drop-in replacement for the go-task project 🔥🔥🔥
Install / Use
/learn @HeyMegabyte/BodegaREADME
<!--TERMINALIZETERMINALIZE--><br/><h4 align="center">A gorgeous, feature-packed drop-in replacement for the go-task/task project</h4><br/>
<a href="#table-of-contents" style="width:100%"><img style="width:100%" src="https://gitlab.com/megabyte-labs/assets/-/raw/master/png/aqua-divider.png" /></a>
Table of Contents
<a href="#overview" style="width:100%"><img style="width:100%" src="https://gitlab.com/megabyte-labs/assets/-/raw/master/png/aqua-divider.png" /></a>
Overview
Bodega is an improved version of go-task that brings a slew of new features and improvements. It adds powerful UX features and functional improvements while retaining backwards compatibility. For those of you who do not know, Task is a task runner / Make alternative written in Go. It allows you to define bash script snippets in YML files and provides some advanced features. Some of the features it includes is the ability to define dependencies, running tasks conditionally, caching values, and a built-in method of housing CLI documentation. Bodega takes go-task to the next level by improving the TUI experience and including features that allow you to use the project as a CLI-generator.
<a href="#features" style="width:100%"><img style="width:100%" src="https://gitlab.com/megabyte-labs/assets/-/raw/master/png/aqua-divider.png" /></a>
Features
Prompt
A prompt field provides an interactive method of getting user data.
In addition, it controls execution with the validate sub-field
which, on correct input, executes the task answer.
The user's selection (or input) is available as the .ANSWER template variable
---
version: '3'
tasks:
test_prompt:
vars:
TEST: 'string'
prompt:
# available types:
# multiline, multi_select, select, password, confirm, input
type: input
message: What day is it?
# The options sub-field is used with propmpts of type select and multi_select
# options:
# - msg: Sunday
# - Tuesday
# The following is a dynamic option
# - msg:
# sh: date +%A
validate:
sh: '[[ ".ANSWER" == "Tuesday" ]]'
answer:
desc: 'a task executed on valid input only'
cmds:
- echo "successfully executing the answer task"
Initial Shell Script
The field shell_rc is used to load common shell scripts or functions.
It can be specified both globally (on the Taskfile level) and locally
(on each individual task). Commands inside each task loads the
shell_rc field before exeution.
---
version: '3'
shell_rc: |
func(){
echo "global function called!"
}
tasks:
init-script-global:
desc: Testing a local shell_rc field
cmds:
- echo "trying out the global shell_rc field"
- func
init-script:
desc: Testing a local shell_rc field
shell_rc: |
export VAR_INSIDE_INIT_SCRIPT="Hello from init script"
func(){
echo "local function called!"
}
cmds:
- echo "This is a var inside init_script $VAR_INSIDE_INIT_SCRIPT"
- func
- sleep 2 # doing some work
Hide tasks from being listed
The hide field allows a task to not be listed with task --list
It can be also templated using Go templates
remember that Go is strongly typed. comparison must be done between equal types use double quotes for literals inside templates
---
version: '3'
tasks:
error-with-hide:
desc: A hidden task that exits with an errors
vars:
CGO_ENABLED: 'true'
hide: '{{if eq .CGO_ENABLED "true"}} true else false end'
# hide: true
cmds:
- echo "text"
- exit 1
- echo "unreachable"
Initial Status
The initial_status boolean field allows a task to be executed
once if the status has been successfully executed once.
An initial_status without a status is simple ignored
---
version: '3'
tasks:
default:
cmds:
- generate-files
- rm -rf directory/
- generate-files
generate-files:
desc: Generate files diescription
cmds:
- mkdir directory
- touch directory/file1.txt
- touch directory/file2.txt
# test existence of files
status:
- test -d directory
- test -f directory/file1.txt
- test -f directory/file2.txt
initial_status: true
On running task default from the command line, only the first execution of task generate-files is done
Stop commands before execution
Passing the --debug makes Task stop before each command execution, even for commands within a variable.
$ task --debug simple
task: [simple] echo 'hi'
Exec
Related Skills
imsg
349.2kiMessage/SMS CLI for listing chats, history, and sending messages via Messages.app.
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
349.2kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
xurl
349.2kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
