config

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides configuration management for gitcode-cli

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig interface {
	// ActiveToken returns the active token for a host
	ActiveToken(hostname string) (string, string)
	// StoredToken returns the stored token for a host without environment overrides
	StoredToken(hostname string) (string, string)
	// HasActiveToken checks if a token exists for a host
	HasActiveToken(hostname string) bool
	// ActiveUser returns the active user for a host
	ActiveUser(hostname string) (string, error)
	// Hosts returns all configured hosts
	Hosts() []string
	// DefaultHost returns the default host
	DefaultHost() (string, string)
	// Login creates or updates authentication for a host
	Login(hostname, username, token, gitProtocol string, secureStorage bool) (bool, error)
	// Logout removes authentication for a host
	Logout(hostname, username string) error
	// SwitchUser switches the active user for a host
	SwitchUser(hostname, user string) error
}

AuthConfig interface defines authentication operations

type Config

type Config interface {
	// Get retrieves a configuration value
	Get(host, key string) (string, error)
	// Set stores a configuration value
	Set(host, key, value string) error

	// GitProtocol returns the preferred git protocol
	GitProtocol(host string) ConfigEntry
	// Editor returns the preferred editor
	Editor(host string) ConfigEntry
	// Browser returns the preferred browser
	Browser(host string) ConfigEntry
	// Pager returns the preferred pager
	Pager(host string) ConfigEntry

	// Authentication returns authentication configuration
	Authentication() AuthConfig

	// Write persists the configuration
	Write() error
}

Config interface defines configuration operations

func New

func New() Config

New creates a new Config

type ConfigEntry

type ConfigEntry struct {
	Value  string
	Source string // "environment", "config", "default"
}

ConfigEntry represents a configuration value with its source

Source Files

  • auth_config.go
  • config.go

Jump to

Keyboard shortcuts

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