datastore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyUnknown = Policy("")
	PolicyAsk     = Policy("ask")
	PolicyTrust   = Policy("trust")
	PolicyIgnore  = Policy("ignore")
)
View Source
const (
	AddHelpPageStatusNew     = AddHelpPageStatus("new")
	AddHelpPageStatusUpdated = AddHelpPageStatus("updated")
)

Variables

View Source
var CurrentSchemaVersion = 1
View Source
var (
	ErrAppPathIsEmpty = fmt.Errorf("executable path cannot be empty")
)

Functions

func CanonizeExecutablePath

func CanonizeExecutablePath(name, workDir, pathVar, homeDir string) (canonized string, err error)

func CheckExecutablePath

func CheckExecutablePath(executablePath string) error

func CheckHelpPage

func CheckHelpPage(helpPage *HelpPage) (err error)

func IsCommandMatchingContext

func IsCommandMatchingContext(command []string, context FlagContext) bool

Types

type AddHelpPageStatus

type AddHelpPageStatus string

type Command

type Command struct {
	Args []string
	Env  []string
	Dir  string
}

type Completion

type Completion struct {
	Flag    string
	Context FlagContext
}

type FlagContext

type FlagContext struct {
	SubCommand []string `json:"sub-command,omitempty"`
	Framework  string   `json:"framework,omitempty"`
}

type HelpPage

type HelpPage struct {
	ExecutablePath string
	Completions    []Completion
	CheckSum       string
	Command        Command
}

type Policy

type Policy string

type Storage

type Storage interface {
	GetCommandPolicy(args []string) (policy Policy, err error)

	GetAllCompletions() (pages []HelpPage, err error)
	GetCompletions(path string) (completions []Completion, err error)

	AddHelpPage(helpPage *HelpPage, policy Policy) (status AddHelpPageStatus, err error)

	// NB. This command might return null pointers in case some help page is broken.
	ListCommands() (result map[int64]*Command, err error)

	RemoveHelpPage(commandId int64) (path string, err error)

	Close() error
}

func NewSqliteStorage

func NewSqliteStorage(fileName string) (storage Storage, err error)

Jump to

Keyboard shortcuts

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