exec

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package exec implements fd's command execution feature (-x/--exec and -X/--exec-batch), including placeholder substitution and batching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandSet

type CommandSet struct {
	// contains filtered or unexported fields
}

CommandSet is a collection of command templates run in one of the two modes.

func NewBatchCommandSet

func NewBatchCommandSet(input [][]string) (*CommandSet, error)

NewBatchCommandSet builds a batch command set.

func NewCommandSet

func NewCommandSet(input [][]string) (*CommandSet, error)

NewCommandSet builds a one-by-one command set. Each element of input is a command (a list of arguments).

func (*CommandSet) Execute

func (cs *CommandSet) Execute(input string, pathSeparator string, bufferOutput bool) bool

Execute runs all commands for a single input path. Returns true on success.

func (*CommandSet) ExecuteBatch

func (cs *CommandSet) ExecuteBatch(paths []string, limit int, pathSeparator string) bool

ExecuteBatch runs the command(s) once (or in chunks of limit) with all paths.

func (*CommandSet) InBatchMode

func (cs *CommandSet) InBatchMode() bool

InBatchMode reports whether the set runs in batch mode.

type Mode

type Mode int

Mode selects between per-result and batch execution.

const (
	// OneByOne runs the command once per search result.
	OneByOne Mode = iota
	// Batch runs the command once with all results as arguments.
	Batch
)

Jump to

Keyboard shortcuts

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