call

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package call provides helpers for managing and executing asynchronous work

 across multiple repositories. Commands for this batch tool shall execute
 `Do(...)` with a Wrapper containing all of the tasks for that command.

 Example:
 	repos := []string{"repo1", "repo2", "repo3"}
		fwrap := Wrap(Exec("git", "status"), Exec("ls"))
		Do(repos, fwrap)

	The above example code calls `git status` followed by `ls` on all three
	provided repositories, executing asynchronously and printing the output
	in order. Console output will block iteratively across the repository
	list to ensure that the output isn't mixed, but the processing of each
	repository's respective tasks is fully parallel in the background.

	The `Exec` Func builder should be sufficient for most commands, but
	custom Func instances can be defined for more complex scenarios. It
	is also possible to define entire `Wrapper` instances if a specific use
	case requires special handling distinct from the default behavior.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(cmd *cobra.Command, repos []string, callFunc Func, handler ...output.Handler)

Do executes the provided Func on each repository, operating asynchronously by default with configurable concurrency limits. Repository aliases are also expanded here to allow for configurable repository grouping. Output formatting can be fully customized by optionally providing one or more OutputHandler functions. Each repository will also be cloned first if it is missing from the local file system.

Types

type Func added in v0.10.0

type Func func(ctx context.Context, ch output.Channel) error

Func defines an atomic unit of work on a repository. Output should be sent to the channel, which must remain open. Closing a channel from within the context of a Func will result in a panic.

func Exec

func Exec(command string, arguments ...string) Func

Exec creates a new Func to execute the given command and arguments, streaming Stdout and Stderr to the channel and returning error status.

func Wrap

func Wrap(calls ...Func) Func

Wrap each provided Func into a new one that executes them order before terminating.

Jump to

Keyboard shortcuts

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