context

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2017 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package context provides single entry to all resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fatal

func Fatal(err error)

Fatal panics and aborts execution with exit code 1

Types

type AptlyContext

type AptlyContext struct {
	sync.Mutex

	gocontext.Context
	// contains filtered or unexported fields
}

AptlyContext is a common context shared by all commands

func NewContext

func NewContext(flags *flag.FlagSet) (*AptlyContext, error)

NewContext initializes context with default settings

func (*AptlyContext) ArchitecturesList

func (context *AptlyContext) ArchitecturesList() []string

ArchitecturesList returns list of architectures fixed via command line or config

func (*AptlyContext) Cleanup

func (context *AptlyContext) Cleanup()

Cleanup does partial shutdown of context

func (*AptlyContext) CloseDatabase

func (context *AptlyContext) CloseDatabase() error

CloseDatabase closes the db temporarily

func (*AptlyContext) CollectionFactory

func (context *AptlyContext) CollectionFactory() *deb.CollectionFactory

CollectionFactory builds factory producing all kinds of collections

func (*AptlyContext) Config

func (context *AptlyContext) Config() *utils.ConfigStructure

Config loads and returns current configuration

func (*AptlyContext) DBPath

func (context *AptlyContext) DBPath() string

DBPath builds path to database

func (*AptlyContext) Database

func (context *AptlyContext) Database() (database.Storage, error)

Database opens and returns current instance of database

func (*AptlyContext) DependencyOptions

func (context *AptlyContext) DependencyOptions() int

DependencyOptions calculates options related to dependecy handling

func (*AptlyContext) Downloader

func (context *AptlyContext) Downloader() aptly.Downloader

Downloader returns instance of current downloader

func (*AptlyContext) Flags

func (context *AptlyContext) Flags() *flag.FlagSet

Flags returns current command flags

func (*AptlyContext) GetPublishedStorage

func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedStorage

GetPublishedStorage returns instance of PublishedStorage

func (*AptlyContext) GetSigner added in v1.1.0

func (context *AptlyContext) GetSigner() pgp.Signer

GetSigner returns Signer with respect to provider

func (*AptlyContext) GetVerifier added in v1.1.0

func (context *AptlyContext) GetVerifier() pgp.Verifier

GetVerifier returns Verifier with respect to provider

func (*AptlyContext) GlobalFlags

func (context *AptlyContext) GlobalFlags() *flag.FlagSet

GlobalFlags returns flags passed to all commands

func (*AptlyContext) GoContextHandleSignals added in v1.2.0

func (context *AptlyContext) GoContextHandleSignals()

GoContextHandleSignals upgrades context to handle ^C by aborting context

func (*AptlyContext) LookupOption

func (context *AptlyContext) LookupOption(defaultValue bool, name string) (result bool)

LookupOption checks boolean flag with default (usually config) and command-line setting

func (*AptlyContext) PackagePool

func (context *AptlyContext) PackagePool() aptly.PackagePool

PackagePool returns instance of PackagePool

func (*AptlyContext) Progress

func (context *AptlyContext) Progress() aptly.Progress

Progress creates or returns Progress object

func (*AptlyContext) ReOpenDatabase

func (context *AptlyContext) ReOpenDatabase() error

ReOpenDatabase reopens the db after close

func (*AptlyContext) Shutdown

func (context *AptlyContext) Shutdown()

Shutdown shuts context down

func (*AptlyContext) UpdateFlags

func (context *AptlyContext) UpdateFlags(flags *flag.FlagSet)

UpdateFlags sets internal copy of flags in the context

func (*AptlyContext) UploadPath

func (context *AptlyContext) UploadPath() string

UploadPath builds path to upload storage

type FatalError

type FatalError struct {
	ReturnCode int
	Message    string
}

FatalError is type for panicking to abort execution with non-zero exit code and print meaningful explanation

Jump to

Keyboard shortcuts

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