base

package
v1.8.12 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package base implements a common application base currently shared by bridge and IE. The base includes the following:

  • access to standard filesystem locations like config, cache, logging dirs
  • an extensible crash handler
  • versioned cache directory
  • persistent settings
  • event listener
  • credentials store
  • pmapi Manager

In addition, the base initialises logging and reacts to command line arguments which control the log verbosity and enable cpu/memory profiling.

Index

Constants

View Source
const (

	// FlagCLI indicate to start with command line interface.
	FlagCLI = "cli"
)

Variables

This section is empty.

Functions

Types

type Base

type Base struct {
	SentryReporter *sentry.Reporter
	CrashHandler   *crash.Handler
	Locations      *locations.Locations
	Settings       *settings.Settings
	Lock           *os.File
	Cache          *cache.Cache
	Listener       listener.Listener
	Creds          *credentials.Store
	CM             pmapi.Manager
	CookieJar      *cookies.Jar
	UserAgent      *useragent.UserAgent
	Updater        *updater.Updater
	Versioner      *versioner.Versioner
	TLS            *tls.TLS
	Autostart      *autostart.App

	Name string // the app's name
	// contains filtered or unexported fields
}

func New

func New(
	appName,
	appUsage,
	configName,
	updateURLName,
	keychainName,
	cacheVersion string,
) (*Base, error)

func (*Base) AddTeardownAction

func (b *Base) AddTeardownAction(fn func() error)

AddTeardownAction adds an action to perform during app teardown.

func (*Base) NewApp

func (b *Base) NewApp(action func(*Base, *cli.Context) error) *cli.App

func (*Base) SetToRestart

func (b *Base) SetToRestart()

SetToRestart sets the app to restart the next time it is closed.

Jump to

Keyboard shortcuts

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