Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigPath = "~/.cfconfig"

ConfigPath path to config data

View Source
var SessionPath = "~/.cfsession"

SessionPath path to config data

Functions

func Init added in v0.1.1

func Init()

Init unwrap homedir of config path and session path

Types

type CodeTemplate

type CodeTemplate struct {
	Alias        string   `json:"alias"`
	Lang         string   `json:"lang"`
	Path         string   `json:"path"`
	Suffix       []string `json:"suffix"`
	BeforeScript string   `json:"before_script"`
	Script       string   `json:"script"`
	AfterScript  string   `json:"after_script"`
}

CodeTemplate config parse code template

type Config

type Config struct {
	Username string         `json:"username"`
	Password string         `json:"password"`
	Template []CodeTemplate `json:"template"`
	Default  int            `json:"default"`
	// contains filtered or unexported fields
}

Config load and save configuration

func New

func New(path string) *Config

New an empty config

func (*Config) Add

func (c *Config) Add() (err error)

Add template

func (*Config) Alias

func (c *Config) Alias(alias string) []CodeTemplate

Alias return all template which alias equals to alias

func (*Config) DecryptPassword

func (c *Config) DecryptPassword() (string, error)

DecryptPassword get real password

func (*Config) Login

func (c *Config) Login(path string) (err error)

Login configure username and password

func (*Config) SetDefault

func (c *Config) SetDefault() error

SetDefault set default template index

Jump to

Keyboard shortcuts

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