runtask

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

README

Runtask is a task runner that enables writing Taskfile scripts in Go.

Install & Usage

Install runtask globally:

go install github.com/bartdeboer/runtask/cmd/runtask@latest

and start writing your Taskfiles anywhere. Any capitalized function should be available to run from the command line:

import (
	"fmt"
	"io"
	"strings"

	"github.com/bitfield/script"
)

// A simple argument test
func SimpleArg(arg string) {
	fmt.Printf("Hello, %s!\n", arg)
}

// Variadic arguments
func Variadic(arg1 string, args ...string) {
	fmt.Printf("Hello, %s [%s]!\n", arg1, strings.Join(args, ", "))
}

// Ping some address
func Ping(addr string) {
	script.Exec(fmt.Sprintf("ping %s", addr)).Stdout()
}

And run your tasks:

runtask simplearg World
runtask variadic John Jane Johnie
runtask ping 127.0.0.1
runtask help variadic

Runtask looks for the following files:

  • Taskfile
  • Taskfile.go
  • tasks/Taskfile.go

A package name is optional but can be helpful for enabling language support features.

Includes support for .env files.

Runtask uses traefik/yaegi as its Go interpreter.

Next to Go's standard library, bitfield/script is included for convenience.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallFunc

func CallFunc(fn reflect.Value, args []string) ([]reflect.Value, error)

func RunTask

func RunTask() error

Types

This section is empty.

Directories

Path Synopsis
cmd
tests
env

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL