Documentation ¶
Overview ¶
Package helper provides handy func and struct to be reused in commands
Package helper provides handy func and struct to be reused in commands
Index ¶
- func AppAutoComplete(c *cli.Context)
- func AutoComplete(c *cli.Context, cache *FileCache)
- func PrintLinks(l bitclient.Links)
- type Cache
- type FileCache
- func (c *FileCache) Clear() error
- func (c *FileCache) FindRepositoriesBySlug(slug string) []bitclient.Repository
- func (c *FileCache) FindRepository(projectKey string, repoSlug string) (bitclient.Repository, error)
- func (c *FileCache) FindUserByUsername(username string) (bitclient.User, error)
- func (c *FileCache) Load() error
- func (c *FileCache) Save() error
- func (c *FileCache) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppAutoComplete ¶
AppAutoComplete extends the default autocomplete provided by urfave/cli by filtering on flags when - or -- is typed
func AutoComplete ¶
AutoComplete enhance the autocompletion by responding to project / user / username / repository... flags and printing available values from the cache. Everything that get printed by this function could be used as autocompletion value. Space is used as separator.
func PrintLinks ¶
PrintLinks output the bitclient.Links to stdout in a readable way
Types ¶
type Cache ¶
type Cache interface { WriteObject(namespace string, object interface{}) error Clear(namespace string) error }
Cache interface define contract for Cache implementations
type FileCache ¶
type FileCache struct { Users []bitclient.User Projects []bitclient.Project Repositories []bitclient.Repository // contains filtered or unexported fields }
FileCache is a Cache implementation storing data in a file
func NewFileCache ¶
NewFileCache create a new FileCache instance
func (*FileCache) FindRepositoriesBySlug ¶
func (c *FileCache) FindRepositoriesBySlug(slug string) []bitclient.Repository
FindRepositoriesBySlug lookup for given repository slug in cached repositories
func (*FileCache) FindRepository ¶
func (c *FileCache) FindRepository(projectKey string, repoSlug string) (bitclient.Repository, error)
FindRepository lookup for a repository from slug and projectKey