apikey

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package apikey reads an API key a command is given on stdin.

Index

Constants

This section is empty.

Variables

View Source
var System = Terminal{
	IsTerminal: func(f *os.File) bool { return term.IsTerminal(int(f.Fd())) },
	ReadHidden: func(f *os.File) ([]byte, error) { return term.ReadPassword(int(f.Fd())) },
}

System is the real terminal.

Functions

func Read

func Read(provider string, in *os.File, out io.Writer, t Terminal) (string, error)

Read reads the key for provider from in: without echoing it when in is a terminal, so it doesn't stay on screen or in the scrollback, else as a line. The prompt goes to out. An empty key is an error.

Types

type Terminal

type Terminal struct {
	IsTerminal func(f *os.File) bool
	ReadHidden func(f *os.File) ([]byte, error)
}

Terminal tells whether a file is a terminal and reads a line from it without echo. Tests stand in for a terminal with their own.

Jump to

Keyboard shortcuts

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