SkillAgentSearch skills...

Bodega

😉 A gorgeous, feature-packed drop-in replacement for the go-task project 🔥🔥🔥

Install / Use

/learn @HeyMegabyte/Bodega
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<!-- ⚠️ This README has been generated from the file(s) ".config/docs/blueprint-readme-cli.md" ⚠️--><div align="center"> <center> <a href="https://github.com/megabyte-labs/Bodega"> <img width="148" height="148" alt="Bodega logo" src="https://gitlab.com/megabyte-labs/go/cli/bodega/-/raw/master/logo.png" /> </a> </center> </div> <div align="center"> <center><h1 align="center"><i></i>Bodega - Your Go-To Task Runner<i></i></h1></center> <center><h4 style="color: #18c3d1;"><i></i><a href="https://megabyte.space" target="_blank">Megabyte Labs</a></h4><i></i></center> </div> <div align="center"> <a href="https://megabyte.space" title="Megabyte Labs homepage" target="_blank"> <img alt="Homepage" src="https://img.shields.io/website?down_color=%23FF4136&down_message=Down&label=Homepage&logo=home-assistant&logoColor=white&up_color=%232ECC40&up_message=Up&url=https%3A%2F%2Fmegabyte.space&style=for-the-badge" /> </a> <a href="https://github.com/megabyte-labs/Bodega/blob/master/docs/CONTRIBUTING.md" title="Learn about contributing" target="_blank"> <img alt="Contributing" src="https://img.shields.io/badge/Contributing-Guide-0074D9?logo=github-sponsors&logoColor=white&style=for-the-badge" /> </a> <a href="https://app.slack.com/client/T01ABCG4NK1/C01NN74H0LW/details/" title="Chat with us on Slack" target="_blank"> <img alt="Slack" src="https://img.shields.io/badge/Slack-Chat-e01e5a?logo=slack&logoColor=white&style=for-the-badge" /> </a> <a href="link.gitter" title="Chat with the community on Gitter" target="_blank"> <img alt="Gitter" src="https://img.shields.io/gitter/room/megabyte-labs/community?logo=gitter&logoColor=white&style=for-the-badge" /> </a> <a href="https://github.com/megabyte-labs/Bodega" title="GitHub mirror" target="_blank"> <img alt="GitHub" src="https://img.shields.io/badge/Mirror-GitHub-333333?logo=github&style=for-the-badge" /> </a> <a href="https://gitlab.com/megabyte-labs/go/cli/bodega" title="GitLab repository" target="_blank"> <img alt="GitLab" src="https://img.shields.io/badge/Repo-GitLab-fc6d26?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAAHJJREFUCNdNxKENwzAQQNEfWU1ZPUF1cxR5lYxQqQMkLEsUdIxCM7PMkMgLGB6wopxkYvAeI0xdHkqXgCLL0Beiqy2CmUIdeYs+WioqVF9C6/RlZvblRNZD8etRuKe843KKkBPw2azX13r+rdvPctEaFi4NVzAN2FhJMQAAAABJRU5ErkJggg==&style=for-the-badge" /> </a> </div> <br/> <div align="center"> <a title="Version: 11.0.0" href="https://github.com/megabyte-labs/Bodega" target="_blank"> <img alt="Version: 11.0.0" src="https://img.shields.io/badge/version-11.0.0-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAACNJREFUCNdjIACY//+BEp9hhM3hAzYQwoBIAqEDYQrCZLwAAGlFKxU1nF9cAAAAAElFTkSuQmCC&cacheSeconds=2592000&style=flat-square" /> </a> <a title="Go version: goVersion" href="https://github.com/megabyte-labs/Bodega/blob/master/go.mod" target="_blank"> <img alt="Go version: goVersion" src="https://img.shields.io/github/go-mod/go-version/profile.github}}/{{slug?logo=go&logoColor=white&style=flat-square" /> </a> <a title="GitLab build status" href="https://gitlab.com/megabyte-labs/go/cli/bodega/-/commits/master" target="_blank"> <img alt="Build status" src="https://img.shields.io/gitlab/pipeline-status/megabyte-labs/ansible-roles/galaxy_info.role_name?branch=master&label=build&logo=gitlab&style=flat-square" /> </a> <a title="Documentation" href="https://megabyte.space/docs/go" target="_blank"> <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg?logo=readthedocs&style=flat-square" /> </a> <a title="License: MIT" href="https://github.com/megabyte-labs/Bodega/blob/master/LICENSE" target="_blank"> <img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-yellow.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEUAAAD///+l2Z/dAAAAAXRSTlMAQObYZgAAAHpJREFUCNdjYOD/wMDAUP+PgYHxhzwDA/MB5gMM7AwMDxj4GBgKGGQYGCyAEEgbMDDwAAWAwmk8958xpIOI5zKH2RmOyhxmZjguAiKmgIgtQOIYmFgCIp4AlaQ9OczGkJYCJEAGgI0CGwo2HmwR2Eqw5SBnNIAdBHYaAJb6KLM15W/CAAAAAElFTkSuQmCC&style=flat-square" /> </a> </div>

<br/><h4 align="center">A gorgeous, feature-packed drop-in replacement for the go-task/task project</h4><br/>

<!--TERMINALIZE![terminalizer_title](https://gitlab.com/megabyte-labs/go/cli/bodega/-/raw/master/docs/demo.gif)TERMINALIZE-->

<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

View on GitHub
GitHub Stars7
CategoryDevelopment
Updated1y ago
Forks0

Languages

Go

Security Score

60/100

Audited on Apr 4, 2025

No findings