config

package
v0.7.1-0...-009166e Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLogin

func AddLogin(login *Login) error

AddLogin save a login to config

func DeleteLogin

func DeleteLogin(name string) error

DeleteLogin delete a login by name from config

func GetConfigPath

func GetConfigPath() string

GetConfigPath return path to tea config file

func SetDefaultLogin

func SetDefaultLogin(name string) error

SetDefaultLogin set the default login by name (case insensitive)

Types

type LocalConfig

type LocalConfig struct {
	Logins []Login `yaml:"logins"`
}

LocalConfig represents local configurations

type Login

type Login struct {
	Name    string `yaml:"name"`
	URL     string `yaml:"url"`
	Token   string `yaml:"token"`
	Default bool   `yaml:"default"`
	SSHHost string `yaml:"ssh_host"`
	// optional path to the private key
	SSHKey   string `yaml:"ssh_key"`
	Insecure bool   `yaml:"insecure"`
	// User is username from gitea
	User string `yaml:"user"`
	// Created is auto created unix timestamp
	Created int64 `yaml:"created"`
}

Login represents a login to a gitea server, you even could add multiple logins for one gitea server

func GetDefaultLogin

func GetDefaultLogin() (*Login, error)

GetDefaultLogin return the default login

func GetLoginByName

func GetLoginByName(name string) *Login

GetLoginByName get login by name (case insensitive)

func GetLoginByToken

func GetLoginByToken(token string) *Login

GetLoginByToken get login by token

func GetLogins

func GetLogins() ([]Login, error)

GetLogins return all login available by config

func (*Login) Client

func (l *Login) Client() *gitea.Client

Client returns a client to operate Gitea API

func (*Login) GetSSHHost

func (l *Login) GetSSHHost() string

GetSSHHost returns SSH host name

Jump to

Keyboard shortcuts

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