organize_text

package
v0.0.0-...-791c77c Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	sku.Transacted

	IsRoot bool
	Depth  int

	Objects
	Children []*Assignment
	Parent   *Assignment
	// contains filtered or unexported fields
}

func (*Assignment) AddObject

func (a *Assignment) AddObject(v *obj) (err error)

func (Assignment) AlignmentSpacing

func (a Assignment) AlignmentSpacing() int

func (*Assignment) AllTags

func (a *Assignment) AllTags(mes ids.TagMutableSet) (err error)

func (*Assignment) Contains

func (a *Assignment) Contains(e *ids.Tag) bool

func (Assignment) GetDepth

func (a Assignment) GetDepth() int

func (Assignment) MaxDepth

func (a Assignment) MaxDepth() (d int)

func (Assignment) MaxLen

func (a Assignment) MaxLen() (m int)

func (*Assignment) SortChildren

func (parent *Assignment) SortChildren()

func (Assignment) String

func (a Assignment) String() (s string)

func (*Assignment) SubtractFromSet

func (a *Assignment) SubtractFromSet(es ids.TagMutableSet) (err error)

type Changes

type Changes struct {
	Before, After  SkuMapWithOrder
	Added, Removed SkuMapWithOrder
	Changed        SkuMapWithOrder
}

func ChangesFrom

func ChangesFrom(
	po options_print.V0,
	a, b *Text,
	original sku.SkuTypeSet,
) (c Changes, err error)

func ChangesFromResults

func ChangesFromResults(
	po options_print.V0,
	results OrganizeResults,
) (c Changes, err error)

func (Changes) String

func (c Changes) String() string

type ErrorRead

type ErrorRead struct {
	// contains filtered or unexported fields
}

type Flags

type Flags struct {
	Options

	ExtraTags collections_ptr.Flag[ids.Tag, *ids.Tag]
	// contains filtered or unexported fields
}

func MakeFlags

func MakeFlags() Flags

func MakeFlagsWithMetadata

func MakeFlagsWithMetadata(m Metadata) Flags

func (*Flags) GetOptions

func (o *Flags) GetOptions(
	printOptions options_print.V0,
	tagSet ids.TagSet,
	skuBoxFormat *box_format.BoxCheckedOut,
	abbr ids.Abbr,
	objectFactory sku.ObjectFactory,
) Options

func (*Flags) GetOptionsWithMetadata

func (o *Flags) GetOptionsWithMetadata(
	printOptions options_print.V0,
	skuFmt *box_format.BoxCheckedOut,
	abbr ids.Abbr,
	objectFactory sku.ObjectFactory,
	m Metadata,
) Options

func (*Flags) SetFlagSet

func (o *Flags) SetFlagSet(f *flag.FlagSet)

type Metadata

type Metadata struct {
	ids.TagSet
	Matchers interfaces.SetLike[sku.Query] // TODO remove
	OptionCommentSet
	Type   ids.Type
	RepoId ids.RepoId
}

TODO replace with embedded *sku.Transacted

func NewMetadata

func NewMetadata(repoId ids.RepoId) Metadata

func NewMetadataWithOptionCommentLookup

func NewMetadataWithOptionCommentLookup(
	repoId ids.RepoId,
	elements map[string]OptionComment,
) Metadata

func (Metadata) AsMetadata

func (m Metadata) AsMetadata() (m1 object_metadata.Metadata)

func (Metadata) GetMetadataWriterTo

func (m Metadata) GetMetadataWriterTo() triple_hyphen_io.MetadataWriterTo

func (*Metadata) GetTags

func (m *Metadata) GetTags() ids.TagSet

func (Metadata) HasMetadataContent

func (m Metadata) HasMetadataContent() bool

func (*Metadata) ReadFrom

func (m *Metadata) ReadFrom(r1 io.Reader) (n int64, err error)

func (Metadata) RemoveFromTransacted

func (m Metadata) RemoveFromTransacted(sk sku.SkuType) (err error)

func (*Metadata) SetFromObjectMetadata

func (m *Metadata) SetFromObjectMetadata(
	om *object_metadata.Metadata,
	repoId ids.RepoId,
) (err error)

func (Metadata) WriteTo

func (m Metadata) WriteTo(w1 io.Writer) (n int64, err error)

type Objects

type Objects []*obj

func (*Objects) Add

func (os *Objects) Add(v *obj) error

func (*Objects) All

func (os *Objects) All() iter.Seq2[int, *obj]

func (Objects) Any

func (os Objects) Any() *obj

func (*Objects) Del

func (os *Objects) Del(v *obj) error

func (*Objects) Each

func (os *Objects) Each(f interfaces.FuncIter[*obj]) (err error)

TODO remove

func (Objects) Len

func (os Objects) Len() int

func (Objects) Sort

func (objects Objects) Sort()

type OptionComment

type OptionComment interface {
	CloneOptionComment() OptionComment
	interfaces.StringerSetter
}

type OptionCommentBooleanFlag

type OptionCommentBooleanFlag struct {
	Value   *bool
	Comment string
}

func (OptionCommentBooleanFlag) CloneOptionComment

func (ocf OptionCommentBooleanFlag) CloneOptionComment() OptionComment

func (OptionCommentBooleanFlag) Set

func (ocf OptionCommentBooleanFlag) Set(v string) (err error)

func (OptionCommentBooleanFlag) String

func (ocf OptionCommentBooleanFlag) String() string

type OptionCommentDryRun

type OptionCommentDryRun struct {
	interfaces.MutableConfigDryRun
}

func (*OptionCommentDryRun) CloneOptionComment

func (ocf *OptionCommentDryRun) CloneOptionComment() OptionComment

func (*OptionCommentDryRun) Set

func (ocf *OptionCommentDryRun) Set(v string) (err error)

func (*OptionCommentDryRun) String

func (ocf *OptionCommentDryRun) String() string

type OptionCommentSet

type OptionCommentSet struct {
	OptionComments []OptionComment
	// contains filtered or unexported fields
}

func MakeOptionCommentSet

func MakeOptionCommentSet(
	elements map[string]OptionComment,
	options ...OptionComment,
) OptionCommentSet

TODO add config to automatically add dry run if necessary

func (*OptionCommentSet) AddPrototype

func (ocs *OptionCommentSet) AddPrototype(
	key string,
	o OptionComment,
) OptionComment

func (*OptionCommentSet) AddPrototypeAndOption

func (ocs *OptionCommentSet) AddPrototypeAndOption(
	key string,
	o OptionComment,
) OptionComment

func (*OptionCommentSet) GetPrototypeOptionComments

func (ocs *OptionCommentSet) GetPrototypeOptionComments() PrototypeOptionComments

func (*OptionCommentSet) Set

func (ocs *OptionCommentSet) Set(v string) (err error)

type OptionCommentUnknown

type OptionCommentUnknown struct {
	Value string
}

func (OptionCommentUnknown) CloneOptionComment

func (ocf OptionCommentUnknown) CloneOptionComment() OptionComment

func (*OptionCommentUnknown) Set

func (ocf *OptionCommentUnknown) Set(v string) (err error)

func (OptionCommentUnknown) String

func (ocf OptionCommentUnknown) String() string

type OptionCommentWithApply

type OptionCommentWithApply interface {
	OptionComment
	ApplyToText(Options, *Assignment) error
	ApplyToReader(Options, *reader) error
	ApplyToWriter(Options, *writer) error
}

type OptionCommentWithKey

type OptionCommentWithKey struct {
	Key string
	OptionComment
}

TODO add support for ApplyTo*

func (OptionCommentWithKey) CloneOptionComment

func (ocf OptionCommentWithKey) CloneOptionComment() OptionComment

func (OptionCommentWithKey) Set

func (ocf OptionCommentWithKey) Set(v string) (err error)

func (OptionCommentWithKey) String

func (ocf OptionCommentWithKey) String() string

type Options

type Options struct {
	Config interface {
		interfaces.MutableConfigDryRun
		interfaces.ConfigGetFilters
	}

	Metadata

	GroupingTags ids.TagSlice
	ExtraTags    ids.TagSet
	Skus         sku.SkuTypeSet

	sku.ObjectFactory

	Abbr ids.Abbr

	UsePrefixJoints   bool
	UseRefiner        bool
	UseMetadataHeader bool
	Limit             int

	PrintOptions options_print.V0
	// contains filtered or unexported fields
}

func (Options) Make

func (o Options) Make() (ot *Text, err error)

type OrganizeResults

type OrganizeResults struct {
	Before, After *Text
	Original      sku.SkuTypeSet
	QueryGroup    *query.Query
}

TODO combine with above

type PrefixSet

type PrefixSet struct {
	// contains filtered or unexported fields
}

func MakePrefixSet

func MakePrefixSet(c int) (s PrefixSet)

func MakePrefixSetFrom

func MakePrefixSetFrom(
	ts objSet,
) (s PrefixSet)

func (*PrefixSet) Add

func (s *PrefixSet) Add(z *obj) (err error)

this splits on right-expanded

func (*PrefixSet) AddSku

func (s *PrefixSet) AddSku(object sku.SkuType) (err error)

func (PrefixSet) AllObjectSets

func (a PrefixSet) AllObjectSets() iter.Seq2[string, objSet]

func (PrefixSet) AllObjects

func (a PrefixSet) AllObjects() iter.Seq2[string, *obj]

func (PrefixSet) Each

func (a PrefixSet) Each(
	f func(ids.Tag, objSet) error,
) (err error)

func (PrefixSet) EachObject

func (a PrefixSet) EachObject(
	f interfaces.FuncIter[*obj],
) error

func (PrefixSet) Len

func (s PrefixSet) Len() int

func (PrefixSet) Match

func (a PrefixSet) Match(
	e ids.Tag,
) (out Segments)

func (PrefixSet) Subset

func (a PrefixSet) Subset(
	e ids.Tag,
) (out Segments)

func (PrefixSet) Subtract

func (a PrefixSet) Subtract(
	b objSet,
) (c PrefixSet)

type PrototypeOptionComments

type PrototypeOptionComments map[string]OptionComment

type Refiner

type Refiner struct {
	Enabled         bool
	UsePrefixJoints bool
}

func (*Refiner) Refine

func (atc *Refiner) Refine(a *Assignment) (err error)

passed-in assignment may be nil?

type Segments

type Segments struct {
	Ungrouped objSet
	Grouped   PrefixSet
}

type SkuMapWithOrder

type SkuMapWithOrder struct {
	// contains filtered or unexported fields
}

func MakeSkuMapWithOrder

func MakeSkuMapWithOrder(c int) (out SkuMapWithOrder)

func (*SkuMapWithOrder) Add

func (sm *SkuMapWithOrder) Add(sk sku.SkuType) error

func (*SkuMapWithOrder) AllSkuAndIndex

func (smwo *SkuMapWithOrder) AllSkuAndIndex() iter.Seq2[int, sku.SkuType]

func (*SkuMapWithOrder) AsExternalLikeSet

func (smwo *SkuMapWithOrder) AsExternalLikeSet() sku.SkuTypeSetMutable

func (*SkuMapWithOrder) AsTransactedSet

func (smwo *SkuMapWithOrder) AsTransactedSet() sku.TransactedMutableSet

func (*SkuMapWithOrder) Clone

func (sm *SkuMapWithOrder) Clone() (out SkuMapWithOrder)

func (*SkuMapWithOrder) Del

func (sm *SkuMapWithOrder) Del(sk sku.SkuType) error

func (*SkuMapWithOrder) Len

func (sm *SkuMapWithOrder) Len() int

func (SkuMapWithOrder) Sorted

func (sm SkuMapWithOrder) Sorted() (out []sku.SkuType)

type TagSetGetter

type TagSetGetter interface {
	GetTags() ids.TagSet
}

type Text

type Text struct {
	Options
	*Assignment // TODO make not embedded
}

func New

func New(options Options) (ot *Text, err error)

func (*Text) GetSkus

func (ot *Text) GetSkus(
	original sku.SkuTypeSet,
) (out SkuMapWithOrder, err error)

func (*Text) ReadFrom

func (t *Text) ReadFrom(r io.Reader) (n int64, err error)

func (*Text) Refine

func (t *Text) Refine() (err error)

func (Text) WriteTo

func (ot Text) WriteTo(out io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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