Help us shape the future of Go! Take the 2026 Go Developer Survey

listfile

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package listfile reads the files of IDs and names that bulk commands take through --from-file, one entry per line.

Index

Constants

View Source
const MaxLen = 255

MaxLen is the longest entry, in characters, that Read accepts: the maxLength the Jamf Pro API spec declares for its name fields.

Variables

This section is empty.

Functions

func Opaque

func Opaque(msg string, err error) error

Opaque returns an error that has err's exit code and hint, and msg in place of err's text. A hint is the CLI's own remedy text and never quotes the request. A lookup that ends in a usage error is a name matching more than one record, and the message says so.

Types

type Entry

type Entry struct {
	Value string
	// Line is the entry's 1-based line in its file, or 0 when it was not
	// read from a file.
	Line int
}

Entry is one ID or name from a list file, or one given on the command line.

func Read

func Read(path string) ([]Entry, error)

Read returns the entries in the file at path, skipping a leading byte order mark, blank lines and #-comments. It refuses the whole file when a line cannot be an ID or a name, and the refusal names only the line.

func (Entry) Hidden

func (e Entry) Hidden() bool

Hidden reports whether messages must leave the entry's value out: true for an entry read from a file in an MCP child.

func (Entry) Hide

func (e Entry) Hide(err error) error

Hide returns err, or for a hidden entry an error that keeps only err's exit code and hint.

func (Entry) Label

func (e Entry) Label() string

Label names the entry in a message: its quoted value, or its line when the value is hidden.

func (Entry) Target

func (e Entry) Target(id string) string

Target names the record the entry resolved to, as its quoted value and ID. A hidden entry is named by its line, with the ID only when it differs from the value: a numeric entry is its own ID until the server has answered.

func (Entry) Wrap

func (e Entry) Wrap(msg string, err error) error

Wrap returns err after msg. When the entry is hidden it keeps only err's exit code and hint.

Jump to

Keyboard shortcuts

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