internal

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Source     ReadSource `json:"-" yaml:"-"`
	LoadedFrom string     `json:"-" yaml:"-"`
	Tags       Tags       `json:"tags" yaml:"tags"`
}

Config contains all runtime configuration for ew, such as available tags.

func ParseConfigFromFolder

func ParseConfigFromFolder(output io.Writer, path string) Config

ParseConfigFromFolder parses the given folder for a valid ew config, or returns the default (empty) config if none can be found.

func (*Config) AddPathsToTag added in v1.0.0

func (c *Config) AddPathsToTag(tag string, paths ...string)

AddPathsToTag adds a list of paths to a tag.

func (Config) GetPathsOfTagSorted

func (c Config) GetPathsOfTagSorted(tag string) []string

GetPathsOfTagSorted returns a sorted list of paths of the given tag.

func (Config) GetPathsOfTagsSorted

func (c Config) GetPathsOfTagsSorted(tags ...string) []string

GetPathsOfTagSorted returns a sorted list of paths of the given tags. Note, paths are sorted tag agnostic, so mixing up might occur. Duplicates are also filtered out.

func (Config) GetTagsOfPathSorted

func (c Config) GetTagsOfPathSorted(path string) []string

GetTagsOfPathSorted returns a sorted list of tags by which the given path is tagged with.

func (Config) GetTagsSorted

func (c Config) GetTagsSorted() []string

GetTagsSorted returns a sorted list of configured tags.

func (*Config) ReWriteConfig added in v1.0.0

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

ReWriteConfig re-writes the config from the path it was loaded from.

func (*Config) RemovePathsFromTag added in v1.0.0

func (c *Config) RemovePathsFromTag(tag string, paths ...string)

RemovePathsFromTag removes a list of paths from a tag.

func (*Config) WriteConfig

func (c *Config) WriteConfig(path string) (string, error)

WriteConfig writes the config to the given folder. Naming of the file is derived from the read source of the config.

type ReadSource

type ReadSource int

ReadSource determinate from which source a given config was read, and/or in which format it should be persisted.

const (
	JsonSrc ReadSource = iota
	YamlSrc
)

type Tags

type Tags map[string][]string

Tags is a convenience wrapper around map[string][]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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