config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config handles reading and writing the Hardcover CLI configuration file (a JSON document containing the API token).

Index

Constants

View Source
const EnvVar = "HARDCOVER_TOKEN"

EnvVar is the fallback environment variable for the API token.

View Source
const FileName = ".hardcover.json"

FileName is the file used in the user's home directory.

Variables

This section is empty.

Functions

func DeleteView added in v0.2.0

func DeleteView(name string) error

func LoadToken

func LoadToken() (string, error)

LoadToken returns the API token from the config file, or the HARDCOVER_TOKEN env var as a fallback. Returns errs.ErrNoToken (wrapped) if neither yields a value.

func LoadViews added in v0.2.0

func LoadViews() (map[string]string, error)

func PromptToken

func PromptToken() (string, error)

PromptToken reads a token from the terminal with echo disabled, falling back to plain read if the terminal doesn't support raw mode.

func SaveToken

func SaveToken(token string) error

SaveToken writes the token to the config file with 0600 permissions. On non-Windows systems, explicitly chmods the file in case it already existed with looser permissions.

func SaveView added in v0.2.0

func SaveView(name, query string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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