Documentation ¶
Overview ¶
Package id List is responsible for id List managing
Index ¶
- Variables
- func ConditionalFilePath(fn string) string
- func ScUpdate(fnJSON string) error
- func ScZero(SrcZ string, cmd *flag.FlagSet) error
- func ZeroSourceTreeIds(srcRoot string, run bool)
- type ArrayFlag
- type Item
- type List
- func (p *List) ExtendIDList(id int, typ, fmts string, verbose bool) (int, bool)
- func (p *List) FileWatcher()
- func (p *List) Index(id int) int
- func (p *List) Item(index int) Item
- func (p *List) ReadListFile()
- func (p *List) Update(root string, run, verbose bool) error
- func (p *List) WriteListFile()
- func (p *List) ZeroTimestampCreated()
Constants ¶
This section is empty.
Variables ¶
var ( // Verbose gives mor information on output if set. The value is injected from main packages. Verbose bool // DryRun if set, inhibits real changes DryRun bool // FnJSON is the filename for the JSON formatted ID list. FnJSON string )
Functions ¶
func ConditionalFilePath ¶ added in v0.10.0
ConditionalFilePath returns absolute file path if fn is not "off" or "none".
func ZeroSourceTreeIds ¶ added in v0.10.0
ZeroSourceTreeIds is overwriting with 0 all id's from source code tree srcRoot. It does not touch idlist.
Types ¶
type ArrayFlag ¶ added in v0.10.0
type ArrayFlag []string
ArrayFlag is a slice type for multi flag
var ( // Srcs gets multiple files or directories. Srcs ArrayFlag )
type Item ¶
type Item struct { ID int `json:"id"` // identifier FmtType string `json:"fmtType"` // format type (bitsize and number of fmt string parameters) FmtStrg string `json:"fmtStrg"` // format string Created int32 `json:"created"` // utc unix time of creation Removed int32 `json:"removed"` // utc unix time of disappearing in processed src directory }
Item is the basic element
type List ¶
type List struct { // FnJSON is the filename of the id List FnJSON string // ItemList is a slice type containing the ID ItemList. ItemList []Item }
List is the trice ID List
func New ¶ added in v0.10.0
func New() (l *List)
New returns a pointer to a list struct which stays up-to-date in case the til.json file changes.
func (*List) ExtendIDList ¶ added in v0.10.0
ExtendIDList returns id beause it could get changed when id is in List with different typ or fmts. It is an exported function for simplyfing tests in other packets.
func (*List) FileWatcher ¶ added in v0.10.0
func (p *List) FileWatcher()
FileWatcher checks id List file for changes taken from https://medium.com/@skdomino/watch-this-file-watching-in-go-5b5a247cf71f
func (*List) Index ¶ added in v0.10.0
Index returns the index of id inside p.List. If id is not found it returns -1.
func (*List) ReadListFile ¶ added in v0.10.0
func (p *List) ReadListFile()
ReadListFile reads idlist file in internal struct and starts a file watcher.
Just in case the idlist file gets updated, the file watcher updates the internals struct. This way trice needs not to be restarted during development process.
func (*List) Update ¶ added in v0.10.0
Update is parsing source tree root and performing these actions: - replace FmtType( Id(0), ...) with FmtType( Id(n), ...) - find duplicate FmtType( Id(n), ...) and replace one of them if trices are not identical - extend file fnIDList
func (*List) WriteListFile ¶ added in v0.10.0
func (p *List) WriteListFile()
WriteListFile marshalls p.List to p.fnJSON.
func (*List) ZeroTimestampCreated ¶ added in v0.10.0
func (p *List) ZeroTimestampCreated()
ZeroTimestampCreated sets all timstamps 'created' to 0.