templatedcmd

package
v0.0.0-...-bb867e0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package templatedcmd allows expanding command-lines via a simple template-expansion process.

For example the user might wish to run a command with an argument like so:

command {}

But we also support expanding the input into fields, and selecting only a single one, as per:

$ echo "one two" | echo {1}
# -> "one"

All arguments are available via "{}" and "{N}" will refer to the Nth field of the given input.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(template string, input string, split string) []string

Expand performs the expansion of the given input, via the supplied template. As we allow input to be referred to as an array of fields we also let the user specify a split-string here.

By default the input is split on whitespace, but you may supply another string instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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