Documentation ¶
Index ¶
- type CollapsedPaths
- type CommitFileNode
- type CommitFileTree
- func (self *CommitFileTree) CollapsedPaths() *CollapsedPaths
- func (self *CommitFileTree) ExpandToPath(path string)
- func (self *CommitFileTree) Get(index int) *CommitFileNode
- func (self *CommitFileTree) GetAllFiles() []*models.CommitFile
- func (self *CommitFileTree) GetAllItems() []*CommitFileNode
- func (self *CommitFileTree) GetFile(path string) *models.CommitFile
- func (self *CommitFileTree) GetIndexForPath(path string) (int, bool)
- func (self *CommitFileTree) GetRoot() *CommitFileNode
- func (self *CommitFileTree) InTreeMode() bool
- func (self *CommitFileTree) IsCollapsed(path string) bool
- func (self *CommitFileTree) Len() int
- func (self *CommitFileTree) SetTree()
- func (self *CommitFileTree) ToggleCollapsed(path string)
- func (self *CommitFileTree) ToggleShowTree()
- type CommitFileTreeViewModel
- func (self *CommitFileTreeViewModel) GetCanRebase() bool
- func (self *CommitFileTreeViewModel) GetRef() types.Ref
- func (self *CommitFileTreeViewModel) GetSelected() *CommitFileNode
- func (self *CommitFileTreeViewModel) GetSelectedFile() *models.CommitFile
- func (self *CommitFileTreeViewModel) GetSelectedPath() string
- func (self *CommitFileTreeViewModel) SetCanRebase(canRebase bool)
- func (self *CommitFileTreeViewModel) SetRef(ref types.Ref)
- func (self *CommitFileTreeViewModel) ToggleShowTree()
- type FileNode
- func (self *FileNode) GetHasInlineMergeConflicts() bool
- func (self *FileNode) GetHasStagedChanges() bool
- func (self *FileNode) GetHasUnstagedChanges() bool
- func (self *FileNode) GetIsFile() bool
- func (self *FileNode) GetIsTracked() bool
- func (self *FileNode) GetPreviousPath() string
- func (self *FileNode) Raw() *Node[models.File]
- type FileTree
- func (self *FileTree) CollapsedPaths() *CollapsedPaths
- func (self *FileTree) ExpandToPath(path string)
- func (self *FileTree) FilterFiles(test func(*models.File) bool) []*models.File
- func (self *FileTree) Get(index int) *FileNode
- func (self *FileTree) GetAllFiles() []*models.File
- func (self *FileTree) GetAllItems() []*FileNode
- func (self *FileTree) GetFile(path string) *models.File
- func (self *FileTree) GetFilter() FileTreeDisplayFilter
- func (self *FileTree) GetIndexForPath(path string) (int, bool)
- func (self *FileTree) GetRoot() *FileNode
- func (self *FileTree) InTreeMode() bool
- func (self *FileTree) IsCollapsed(path string) bool
- func (self *FileTree) Len() int
- func (self *FileTree) SetStatusFilter(filter FileTreeDisplayFilter)
- func (self *FileTree) SetTree()
- func (self *FileTree) ToggleCollapsed(path string)
- func (self *FileTree) ToggleShowTree()
- func (self *FileTree) Tree() *FileNode
- type FileTreeDisplayFilter
- type FileTreeViewModel
- func (self *FileTreeViewModel) GetSelected() *FileNode
- func (self *FileTreeViewModel) GetSelectedFile() *models.File
- func (self *FileTreeViewModel) GetSelectedPath() string
- func (self *FileTreeViewModel) SetStatusFilter(filter FileTreeDisplayFilter)
- func (self *FileTreeViewModel) SetTree()
- func (self *FileTreeViewModel) ToggleShowTree()
- type ICommitFileTree
- type ICommitFileTreeViewModel
- type IFileTree
- type IFileTreeViewModel
- type ITree
- type Node
- func BuildFlatTreeFromCommitFiles(files []*models.CommitFile) *Node[models.CommitFile]
- func BuildFlatTreeFromFiles(files []*models.File) *Node[models.File]
- func BuildTreeFromCommitFiles(files []*models.CommitFile) *Node[models.CommitFile]
- func BuildTreeFromFiles(files []*models.File) *Node[models.File]
- func (self *Node[T]) Compress()
- func (self *Node[T]) Description() string
- func (self *Node[T]) Every(test func(*Node[T]) bool) bool
- func (self *Node[T]) EveryFile(test func(*T) bool) bool
- func (self *Node[T]) Flatten(collapsedPaths *CollapsedPaths) []*Node[T]
- func (self *Node[T]) ForEachFile(cb func(*T) error) error
- func (self *Node[T]) GetFilePathsMatching(test func(*T) bool) []string
- func (self *Node[T]) GetIndexForPath(path string, collapsedPaths *CollapsedPaths) (int, bool)
- func (self *Node[T]) GetLeaves() []*Node[T]
- func (self *Node[T]) GetNodeAtIndex(index int, collapsedPaths *CollapsedPaths) *Node[T]
- func (self *Node[T]) GetPath() string
- func (self *Node[T]) GetPathsMatching(test func(*Node[T]) bool) []string
- func (self *Node[T]) ID() string
- func (self *Node[T]) IsFile() bool
- func (self *Node[T]) Size(collapsedPaths *CollapsedPaths) int
- func (self *Node[T]) Some(test func(*Node[T]) bool) bool
- func (self *Node[T]) SomeFile(test func(*T) bool) bool
- func (self *Node[T]) Sort()
- func (self *Node[T]) SortChildren()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollapsedPaths ¶
type CollapsedPaths struct {
// contains filtered or unexported fields
}
func NewCollapsedPaths ¶ added in v0.35.0
func NewCollapsedPaths() *CollapsedPaths
func (*CollapsedPaths) Collapse ¶ added in v0.35.0
func (self *CollapsedPaths) Collapse(path string)
func (*CollapsedPaths) ExpandToPath ¶
func (self *CollapsedPaths) ExpandToPath(path string)
func (*CollapsedPaths) IsCollapsed ¶
func (self *CollapsedPaths) IsCollapsed(path string) bool
func (*CollapsedPaths) ToggleCollapsed ¶
func (self *CollapsedPaths) ToggleCollapsed(path string)
type CommitFileNode ¶
type CommitFileNode struct { *Node[models.CommitFile] }
CommitFileNode wraps a node and provides some commit-file-specific methods for it.
func NewCommitFileNode ¶ added in v0.36.0
func NewCommitFileNode(node *Node[models.CommitFile]) *CommitFileNode
func (*CommitFileNode) Raw ¶ added in v0.36.0
func (self *CommitFileNode) Raw() *Node[models.CommitFile]
returns the underlying node, without any commit-file-specific methods attached
type CommitFileTree ¶ added in v0.35.0
type CommitFileTree struct {
// contains filtered or unexported fields
}
func NewCommitFileTree ¶ added in v0.35.0
func NewCommitFileTree(getFiles func() []*models.CommitFile, log *logrus.Entry, showTree bool) *CommitFileTree
func (*CommitFileTree) CollapsedPaths ¶ added in v0.35.0
func (self *CommitFileTree) CollapsedPaths() *CollapsedPaths
func (*CommitFileTree) ExpandToPath ¶ added in v0.35.0
func (self *CommitFileTree) ExpandToPath(path string)
func (*CommitFileTree) Get ¶ added in v0.35.0
func (self *CommitFileTree) Get(index int) *CommitFileNode
func (*CommitFileTree) GetAllFiles ¶ added in v0.35.0
func (self *CommitFileTree) GetAllFiles() []*models.CommitFile
func (*CommitFileTree) GetAllItems ¶ added in v0.35.0
func (self *CommitFileTree) GetAllItems() []*CommitFileNode
func (*CommitFileTree) GetFile ¶ added in v0.35.0
func (self *CommitFileTree) GetFile(path string) *models.CommitFile
func (*CommitFileTree) GetIndexForPath ¶ added in v0.35.0
func (self *CommitFileTree) GetIndexForPath(path string) (int, bool)
func (*CommitFileTree) GetRoot ¶ added in v0.36.0
func (self *CommitFileTree) GetRoot() *CommitFileNode
func (*CommitFileTree) InTreeMode ¶ added in v0.35.0
func (self *CommitFileTree) InTreeMode() bool
func (*CommitFileTree) IsCollapsed ¶ added in v0.35.0
func (self *CommitFileTree) IsCollapsed(path string) bool
func (*CommitFileTree) Len ¶ added in v0.35.0
func (self *CommitFileTree) Len() int
func (*CommitFileTree) SetTree ¶ added in v0.35.0
func (self *CommitFileTree) SetTree()
func (*CommitFileTree) ToggleCollapsed ¶ added in v0.35.0
func (self *CommitFileTree) ToggleCollapsed(path string)
func (*CommitFileTree) ToggleShowTree ¶ added in v0.35.0
func (self *CommitFileTree) ToggleShowTree()
type CommitFileTreeViewModel ¶ added in v0.35.0
type CommitFileTreeViewModel struct { sync.RWMutex ICommitFileTree types.IListCursor // contains filtered or unexported fields }
func NewCommitFileTreeViewModel ¶ added in v0.35.0
func NewCommitFileTreeViewModel(getFiles func() []*models.CommitFile, log *logrus.Entry, showTree bool) *CommitFileTreeViewModel
func (*CommitFileTreeViewModel) GetCanRebase ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) GetCanRebase() bool
func (*CommitFileTreeViewModel) GetRef ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) GetRef() types.Ref
func (*CommitFileTreeViewModel) GetSelected ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) GetSelected() *CommitFileNode
func (*CommitFileTreeViewModel) GetSelectedFile ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) GetSelectedFile() *models.CommitFile
func (*CommitFileTreeViewModel) GetSelectedPath ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) GetSelectedPath() string
func (*CommitFileTreeViewModel) SetCanRebase ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) SetCanRebase(canRebase bool)
func (*CommitFileTreeViewModel) SetRef ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) SetRef(ref types.Ref)
func (*CommitFileTreeViewModel) ToggleShowTree ¶ added in v0.35.0
func (self *CommitFileTreeViewModel) ToggleShowTree()
duplicated from file_tree_view_model.go. Generics will help here
type FileNode ¶
FileNode wraps a node and provides some file-specific methods for it.
func (*FileNode) GetHasInlineMergeConflicts ¶
func (*FileNode) GetHasStagedChanges ¶
func (*FileNode) GetHasUnstagedChanges ¶
func (*FileNode) GetIsTracked ¶
func (*FileNode) GetPreviousPath ¶ added in v0.35.0
type FileTree ¶ added in v0.35.0
type FileTree struct {
// contains filtered or unexported fields
}
func NewFileTree ¶ added in v0.35.0
func (*FileTree) CollapsedPaths ¶ added in v0.35.0
func (self *FileTree) CollapsedPaths() *CollapsedPaths
func (*FileTree) ExpandToPath ¶ added in v0.35.0
func (*FileTree) FilterFiles ¶ added in v0.35.0
func (*FileTree) GetAllFiles ¶ added in v0.35.0
func (*FileTree) GetAllItems ¶ added in v0.35.0
note: this gets all items when the filter is taken into consideration. There may be hidden files that aren't included here. Files off the screen however will be included
func (*FileTree) GetFilter ¶ added in v0.35.0
func (self *FileTree) GetFilter() FileTreeDisplayFilter
func (*FileTree) GetIndexForPath ¶ added in v0.35.0
func (*FileTree) InTreeMode ¶ added in v0.35.0
func (*FileTree) IsCollapsed ¶ added in v0.35.0
func (*FileTree) SetStatusFilter ¶ added in v0.39.0
func (self *FileTree) SetStatusFilter(filter FileTreeDisplayFilter)
func (*FileTree) ToggleCollapsed ¶ added in v0.35.0
func (*FileTree) ToggleShowTree ¶ added in v0.35.0
func (self *FileTree) ToggleShowTree()
type FileTreeDisplayFilter ¶ added in v0.35.0
type FileTreeDisplayFilter int
const ( DisplayAll FileTreeDisplayFilter = iota DisplayStaged DisplayUnstaged // this shows files with merge conflicts DisplayConflicted )
type FileTreeViewModel ¶ added in v0.35.0
type FileTreeViewModel struct { sync.RWMutex IFileTree types.IListCursor }
This combines our FileTree struct with a cursor that retains information about which item is selected. It also contains logic for repositioning that cursor after the files are refreshed
func NewFileTreeViewModel ¶ added in v0.35.0
func (*FileTreeViewModel) GetSelected ¶ added in v0.35.0
func (self *FileTreeViewModel) GetSelected() *FileNode
func (*FileTreeViewModel) GetSelectedFile ¶ added in v0.35.0
func (self *FileTreeViewModel) GetSelectedFile() *models.File
func (*FileTreeViewModel) GetSelectedPath ¶ added in v0.35.0
func (self *FileTreeViewModel) GetSelectedPath() string
func (*FileTreeViewModel) SetStatusFilter ¶ added in v0.39.0
func (self *FileTreeViewModel) SetStatusFilter(filter FileTreeDisplayFilter)
func (*FileTreeViewModel) SetTree ¶ added in v0.35.0
func (self *FileTreeViewModel) SetTree()
func (*FileTreeViewModel) ToggleShowTree ¶ added in v0.35.0
func (self *FileTreeViewModel) ToggleShowTree()
If we're going from flat to tree we want to select the same file. If we're going from tree to flat and we have a file selected we want to select that. If instead we've selected a directory we need to select the first file in that directory.
type ICommitFileTree ¶ added in v0.35.0
type ICommitFileTree interface { ITree[models.CommitFile] Get(index int) *CommitFileNode GetFile(path string) *models.CommitFile GetAllItems() []*CommitFileNode GetAllFiles() []*models.CommitFile GetRoot() *CommitFileNode }
type ICommitFileTreeViewModel ¶ added in v0.35.0
type ICommitFileTreeViewModel interface { ICommitFileTree types.IListCursor GetRef() types.Ref SetRef(types.Ref) GetCanRebase() bool SetCanRebase(bool) }
type IFileTree ¶ added in v0.35.0
type IFileTree interface { ITree[models.File] FilterFiles(test func(*models.File) bool) []*models.File SetStatusFilter(filter FileTreeDisplayFilter) Get(index int) *FileNode GetFile(path string) *models.File GetAllItems() []*FileNode GetAllFiles() []*models.File GetFilter() FileTreeDisplayFilter GetRoot() *FileNode }
type IFileTreeViewModel ¶ added in v0.35.0
type IFileTreeViewModel interface { IFileTree types.IListCursor }
type Node ¶ added in v0.36.0
type Node[T any] struct { // File will be nil if the node is a directory. File *T // If the node is a directory, Children contains the contents of the directory, // otherwise it's nil. Children []*Node[T] // path of the file/directory Path string // rather than render a tree as: // a/ // b/ // file.blah // // we instead render it as: // a/b/ // file.blah // This saves vertical space. The CompressionLevel of a node is equal to the // number of times a 'compression' like the above has happened, where two // nodes are squished into one. CompressionLevel int }
Represents a file or directory in a file tree.
func BuildFlatTreeFromCommitFiles ¶
func BuildFlatTreeFromCommitFiles(files []*models.CommitFile) *Node[models.CommitFile]
func BuildTreeFromCommitFiles ¶
func BuildTreeFromCommitFiles(files []*models.CommitFile) *Node[models.CommitFile]
func (*Node[T]) Description ¶ added in v0.36.0
func (*Node[T]) Flatten ¶ added in v0.36.0
func (self *Node[T]) Flatten(collapsedPaths *CollapsedPaths) []*Node[T]
func (*Node[T]) ForEachFile ¶ added in v0.36.0
func (*Node[T]) GetFilePathsMatching ¶ added in v0.36.0
func (*Node[T]) GetIndexForPath ¶ added in v0.36.0
func (self *Node[T]) GetIndexForPath(path string, collapsedPaths *CollapsedPaths) (int, bool)
func (*Node[T]) GetNodeAtIndex ¶ added in v0.36.0
func (self *Node[T]) GetNodeAtIndex(index int, collapsedPaths *CollapsedPaths) *Node[T]
func (*Node[T]) GetPathsMatching ¶ added in v0.36.0
func (*Node[T]) Size ¶ added in v0.36.0
func (self *Node[T]) Size(collapsedPaths *CollapsedPaths) int
func (*Node[T]) SortChildren ¶ added in v0.36.0
func (self *Node[T]) SortChildren()