env

package
v0.0.0-...-277146c Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPagerCommand     = "less"
	DefaultPagerEnvironment = []string{"LESS=FRX", "LV=-c"}
)

Parameters for external Pager program:

Functions

func PathHomeDir

func PathHomeDir() string

PathHomeDir returns home directory of the calling user

func PathUserConfDir

func PathUserConfDir(program string) string

PathUserConfDir returns user configuration directory for the program

Types

type Pager

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

Pager scrolls potentially large text in a terminal.

Implements io.Writer interface.

func NewPager

func NewPager() *Pager

NewPager creates a new Pager

func (*Pager) Display

func (p *Pager) Display() error

Display shows collected text in terminal.

func (*Pager) Printf

func (p *Pager) Printf(format string, args ...any) (n int, err error)

Printf writes formatted line into the Pager, adding newline character after end of the line.

It returns the number of bytes written and any write error encountered.

func (*Pager) Write

func (p *Pager) Write(text []byte) (n int, err error)

Write collects text for display. All subsequent writes are concatenated and displayed as a whole.

Implements io.Writer interface.

type Runner

type Runner struct {
	CUPSPort int    // CUPS server port, 0 if none
	ESCLPort int    // eSCL server port, 0 if none
	ESCLPath string // Path part of the eSCL URL
	ESCLName string // eSCL scanner name (will be visible as SANE name)
}

Runner runs external program in the environment, where interactions with CUPS and the eSCL scanner are redirected to the specified ports and can be intercepted.

It does its work by setting the following environment variables:

In the context of the program being executed, these variables are interpreted by the libcups.so and sane-airscan, respectively.

This is used by the mfp-proxy and mfp-virtual commands.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context,
	command string, args ...string) error

Run executes the command and waits for its completion. Command execution can be terminated by canceling the supplied context.Context.

Jump to

Keyboard shortcuts

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