runtask

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 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@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

Runtask uses traefik/yaegi as its Go interpreter.

Next to Go's standard library, it also includes bitfield/script for convenience.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
tests
env

Jump to

Keyboard shortcuts

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