action

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: ISC Imports: 2 Imported by: 0

Documentation

Overview

Package action contains the type Action and some basic actions.

The actions are functions that act on the file system (although they do not necessarily have to do it).

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(path string, args []string) string

Print prints the arguments provided in the standard output, this does not print spaces between the arguments, nor does it add a line break at the end.

Example
package main

import (
	"github.com/anderson-lt/fairu/action"
)

func main() {
	action.Print("/a/path", []string{"0", "1", "2", "3"})
}
Output:

0123

func PrintAlternative added in v0.2.1

func PrintAlternative(path string, args []string) string

PrintAlternative is similar to Print, but, write on the standard error output.

func Say added in v0.2.1

func Say(path string, args []string) string

Say print the arguments provided in the standard output and format them by separating those with a space and adding a line break at the end.

Example
package main

import (
	"github.com/anderson-lt/fairu/action"
)

func main() {
	action.Say("/a/path", []string{"Hello", "World!"})
}
Output:

Hello World!

func SayAlternative added in v0.2.1

func SayAlternative(path string, args []string) string

SayAlternative is similar to Say, but, write on the standard error output.

Types

type Action

type Action func(path string, args []string) (newPath string)

Action represents the signature of an action, where path refers to the action path and arguments of the action. Returns a newPath chain that specifies the new acting path, for example, when the file moves, an empty string indicates that the file was deleted. If the file path is not modified, you must return where it was provided in path.

Jump to

Keyboard shortcuts

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