netrc

package
v1.76.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 3 modules, 11 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package netrc contains functionality to work with netrc.

Index

Constants

View Source
const Filename = netrcFilename

Filename exposes the netrc filename based on the current operating system.

Variables

This section is empty.

Functions

func DeleteMachineForName

func DeleteMachineForName(envContainer app.EnvContainer, name string) (bool, error)

DeleteMachineForName deletes the Machine for the given name, if set.

Returns false if there was no Machine for the given name.

func GetFilePath

func GetFilePath(envContainer app.EnvContainer) (string, error)

GetFilePath gets the netrc file path for the given environment.

func PutMachines

func PutMachines(envContainer app.EnvContainer, machines ...Machine) error

PutMachines adds the given Machines to the configured netrc file.

Types

type Machine

type Machine interface {
	// Empty for default machine.
	Name() string
	Login() string
	Password() string
}

Machine is a machine.

func GetMachineForName

func GetMachineForName(envContainer app.EnvContainer, name string) (_ Machine, retErr error)

GetMachineForName returns the Machine for the given name.

Returns nil if no such Machine.

func GetMachineForNameAndFilePath added in v1.18.0

func GetMachineForNameAndFilePath(name string, filePath string) (_ Machine, retErr error)

GetMachineForNameAndFilePath returns the Machine for the given name from the file at the given path.

Returns nil if no such Machine or no such file.

func NewMachine

func NewMachine(
	name string,
	login string,
	password string,
) Machine

NewMachine creates a new Machine.

Jump to

Keyboard shortcuts

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