Documentation
¶
Index ¶
- Constants
- Variables
- func BlameDialog(ctx core.Widget, fname string, blame, fbytes []byte) *texteditor.TwinEditors
- func FileAtRevDialog(ctx core.Widget, repo vcs.Repo, file, rev string) *core.Body
- func IsVersionControlSystem(str string) bool
- func NodeNameCountSort(ecs []NodeNameCount)
- func VCSLabelFunc(fn *Node, label string) string
- func VCSLogDialog(ctx core.Widget, repo vcs.Repo, lg vcs.Log, file, since string) *core.Body
- type DirFlagMap
- type DirFlags
- func (i DirFlags) BitIndexString() string
- func (i DirFlags) Desc() string
- func (i DirFlags) HasFlag(f enums.BitFlag) bool
- func (i DirFlags) Int64() int64
- func (i DirFlags) MarshalText() ([]byte, error)
- func (i *DirFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *DirFlags) SetInt64(in int64)
- func (i *DirFlags) SetString(s string) error
- func (i *DirFlags) SetStringOr(s string) error
- func (i DirFlags) String() string
- func (i *DirFlags) UnmarshalText(text []byte) error
- func (i DirFlags) Values() []enums.Enum
- type Filer
- type FindLoc
- func (i FindLoc) Desc() string
- func (i FindLoc) Int64() int64
- func (i FindLoc) MarshalText() ([]byte, error)
- func (i *FindLoc) SetInt64(in int64)
- func (i *FindLoc) SetString(s string) error
- func (i FindLoc) String() string
- func (i *FindLoc) UnmarshalText(text []byte) error
- func (i FindLoc) Values() []enums.Enum
- type Node
- func (fn *Node) AddToVCS()
- func (fn *Node) AddToVCSSel()
- func (fn *Node) AsFileNode() *Node
- func (t *Node) AsNode() *Node
- func (fn *Node) BlameVCS() ([]byte, error)
- func (fn *Node) BlameVCSSel()
- func (fn *Node) CanOpen() bool
- func (fn *Node) CloseBuf() bool
- func (fn *Node) CommitToVCS(message string) (err error)
- func (fn *Node) CommitToVCSSel()
- func (fn *Node) ContextMenu(m *core.Scene)
- func (fn *Node) CopyFileToDir(filename string, perm os.FileMode)
- func (fn *Node) Cut()
- func (fn *Node) DeleteFile() error
- func (fn *Node) DeleteFiles()
- func (fn *Node) DeleteFilesImpl()
- func (fn *Node) DeleteFromVCS()
- func (fn *Node) DeleteFromVCSSel()
- func (fn *Node) DetectVCSRepo(updateFiles bool) bool
- func (fn *Node) DiffVCS(rev_a, rev_b string) error
- func (fn *Node) DiffVCSSel(rev_a string, rev_b string)
- func (fn *Node) DirFileList() []os.FileInfo
- func (fn *Node) DirsTo(path string) (*Node, error)
- func (fn *Node) DragDrop(e events.Event)
- func (fn *Node) DropDeleteSource(e events.Event)
- func (fn *Node) DuplicateFile() error
- func (fn *Node) DuplicateFiles()
- func (fn *Node) FileExtCounts(cat fileinfo.Categories) []NodeNameCount
- func (fn *Node) FilesMatching(match string, ignoreCase bool) []*Node
- func (fn *Node) FindDirNode(path string) (*Node, error)
- func (fn *Node) FindFile(fnm string) (*Node, bool)
- func (fn *Node) FirstVCS() (vcs.Repo, *Node)
- func (fn *Node) Init()
- func (fn *Node) InitFileInfo() error
- func (fn *Node) IsAutoSave() bool
- func (fn *Node) IsChanged() bool
- func (fn *Node) IsDir() bool
- func (fn *Node) IsExec() bool
- func (fn *Node) IsExternal() bool
- func (fn *Node) IsIrregular() bool
- func (fn *Node) IsNotSaved() bool
- func (fn *Node) IsOpen() bool
- func (fn *Node) LatestFileMod(cat fileinfo.Categories) time.Time
- func (fn *Node) LogVCS(allFiles bool, since string) (vcs.Log, error)
- func (fn *Node) LogVCSSel()
- func (fn *Node) MimeData(md *mimedata.Mimes)
- func (fn *Node) MyRelPath() string
- func (fn *Node) NewFile(filename string, addToVCS bool)
- func (fn *Node) NewFiles(filename string, addToVCS bool)
- func (fn *Node) NewFolder(foldername string)
- func (fn *Node) NewFolders(foldername string)
- func (fn *Node) OnClose()
- func (fn *Node) OnOpen()
- func (fn *Node) OpenAll()
- func (fn *Node) OpenBuf() (bool, error)
- func (fn *Node) OpenDir()
- func (fn *Node) OpenFileDefault() error
- func (fn *Node) OpenFileWith(command string) error
- func (fn *Node) OpenFilesDefault()
- func (fn *Node) OpenFilesWith()
- func (fn *Node) Paste()
- func (fn *Node) PasteCheckExisting(tfn *Node, md mimedata.Mimes, externalDrop bool) ([]string, *Node)
- func (fn *Node) PasteCopyFiles(tdir *Node, md mimedata.Mimes, externalDrop bool)
- func (fn *Node) PasteCopyFilesCheck(tdir *Node, md mimedata.Mimes, externalDrop bool, dropFinal func())
- func (fn *Node) PasteFiles(md mimedata.Mimes, externalDrop bool, dropFinal func())
- func (fn *Node) RelPath(fpath core.Filename) string
- func (fn *Node) RemoveFromExterns()
- func (fn *Node) RenameFile(newpath string) error
- func (fn *Node) RenameFiles()
- func (fn *Node) Repo() (vcs.Repo, *Node)
- func (fn *Node) RevertVCS() (err error)
- func (fn *Node) RevertVCSSel()
- func (fn *Node) SelectedFunc(fun func(n *Node))
- func (fn *Node) SetFileIcon()
- func (fn *Node) ShowFileInfo()
- func (fn *Node) SortBy(modTime bool)
- func (fn *Node) SortBys(modTime bool)
- func (fn *Node) UpdateAllVCS()
- func (fn *Node) UpdateRepoFiles()
- func (fn *Node) VCSContextMenu(m *core.Scene)
- type NodeEmbedder
- type NodeNameCount
- type SearchResults
- type Tree
- func (ft *Tree) AddExternalFile(fpath string) (*Node, error)
- func (ft *Tree) ConfigWatcher() error
- func (fv *Tree) Destroy()
- func (ft *Tree) DirSortByModTime(fpath core.Filename) bool
- func (ft *Tree) DirSortByName(fpath core.Filename) bool
- func (ft *Tree) ExternalNodeByPath(fpath string) (*Node, error)
- func (ft *Tree) HasExternalFile(fpath string) (bool, int)
- func (ft *Tree) Init()
- func (ft *Tree) IsDirOpen(fpath core.Filename) bool
- func (ft *Tree) OpenPath(path string) *Tree
- func (ft *Tree) RemoveExternalFile(fpath string) bool
- func (ft *Tree) SetDirClosed(fpath core.Filename)
- func (ft *Tree) SetDirOpen(fpath core.Filename)
- func (ft *Tree) SetDirSortBy(fpath core.Filename, modTime bool)
- func (t *Tree) SetDirsOnTop(v bool) *Tree
- func (t *Tree) SetFileNodeType(v *types.Type) *Tree
- func (ft *Tree) UnWatchPath(path core.Filename)
- func (ft *Tree) UpdatePath(path string)
- func (ft *Tree) WatchPath(path core.Filename) error
- func (ft *Tree) WatchUpdate(path string)
- func (ft *Tree) WatchWatcher()
- type VCSLog
- func (lv *VCSLog) Init()
- func (lv *VCSLog) MakeToolbar(p *tree.Plan)
- func (t *VCSLog) SetFile(v string) *VCSLog
- func (t *VCSLog) SetLog(v vcs.Log) *VCSLog
- func (t *VCSLog) SetRepo(v vcs.Repo) *VCSLog
- func (lv *VCSLog) SetRevA(rev string)
- func (lv *VCSLog) SetRevB(rev string)
- func (t *VCSLog) SetSetA(v bool) *VCSLog
- func (t *VCSLog) SetSince(v string) *VCSLog
- func (lv *VCSLog) Table() *core.Table
- func (lv *VCSLog) ToggleRev()
- func (lv *VCSLog) Toolbar() *core.Toolbar
- type VersionControlName
Constants ¶
const (
// ExternalFilesName is the name of the node that represents external files
ExternalFilesName = "[external files]"
)
Variables ¶
var NodeHiStyle = histyle.StyleDefault
NodeHiStyle is the default style for syntax highlighting to use for file node buffers
var VersionControlSystems = []string{"git", "svn", "bzr", "hg"}
VersionControlSystems is a list of supported Version Control Systems. These must match the VCS Types from vcs which in turn is based on masterminds/vcs
Functions ¶
func BlameDialog ¶
func BlameDialog(ctx core.Widget, fname string, blame, fbytes []byte) *texteditor.TwinEditors
BlameDialog opens a dialog for displaying VCS blame data using textview.TwinViews. blame is the annotated blame code, while fbytes is the original file contents.
func FileAtRevDialog ¶
FileAtRevDialog Shows a file at a given revision in a new dialog window
func IsVersionControlSystem ¶ added in v0.0.8
IsVersionControlSystem returns true if the given string matches one of the standard VersionControlSystems -- uses lowercase version of str.
func NodeNameCountSort ¶
func NodeNameCountSort(ecs []NodeNameCount)
func VCSLabelFunc ¶
VCSLabelFunc gets the appropriate label for removing from version control
Types ¶
type DirFlagMap ¶
type DirFlagMap struct {
// map of paths and associated flags
Map map[string]DirFlags
// mutex for accessing map
Mu sync.Mutex `display:"-" json:"-" xml:"-" toml:"-"`
}
DirFlagMap is a map for encoding directories that are open in the file tree. The strings are typically relative paths. The bool value is used to mark active paths and inactive (unmarked) ones can be removed. Map access is protected by Mutex.
func (*DirFlagMap) Init ¶
func (dm *DirFlagMap) Init()
Init initializes the map, and sets the Mutex lock -- must unlock manually
func (*DirFlagMap) IsOpen ¶
func (dm *DirFlagMap) IsOpen(path string) bool
IsOpen returns true if path has IsOpen bit flag set
func (*DirFlagMap) SetOpen ¶
func (dm *DirFlagMap) SetOpen(path string, open bool)
SetOpenState sets the given directory's open flag
func (*DirFlagMap) SetSortBy ¶
func (dm *DirFlagMap) SetSortBy(path string, modTime bool)
SetSortBy sets the given directory's sort by option
func (*DirFlagMap) SortByModTime ¶
func (dm *DirFlagMap) SortByModTime(path string) bool
SortByModTime returns true if path is sorted by mod time
func (*DirFlagMap) SortByName ¶
func (dm *DirFlagMap) SortByName(path string) bool
SortByName returns true if path is sorted by name (default if not in map)
type DirFlags ¶
type DirFlags int64 //enums:bitflag -trim-prefix Dir
DirFlags are flags on directories: Open, SortBy, etc. These flags are stored in the DirFlagMap for persistence. This map is saved to a file, so these flags must be stored as bit flags instead of a struct to ensure efficient serialization.
const ( // DirIsOpen means directory is open -- else closed DirIsOpen DirFlags = iota // DirSortByName means sort the directory entries by name. // this is mutex with other sorts -- keeping option open for non-binary sort choices. DirSortByName // DirSortByModTime means sort the directory entries by modification time DirSortByModTime )
const DirFlagsN DirFlags = 3
DirFlagsN is the highest valid value for type DirFlags, plus one.
func DirFlagsValues ¶
func DirFlagsValues() []DirFlags
DirFlagsValues returns all possible values for the type DirFlags.
func (DirFlags) BitIndexString ¶
BitIndexString returns the string representation of this DirFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (DirFlags) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*DirFlags) SetFlag ¶
SetFlag sets the value of the given flags in these flags to the given value.
func (*DirFlags) SetString ¶
SetString sets the DirFlags value from its string representation, and returns an error if the string is invalid.
func (*DirFlags) SetStringOr ¶
SetStringOr sets the DirFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (*DirFlags) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Filer ¶
type Filer interface {
core.Treer
// AsFileNode returns the filetree.Node
AsFileNode() *Node
// OpenFilesDefault opens selected files with default app for that file type (os defined).
// It runs open on Mac, xdg-open on Linux, and start on Windows.
OpenFilesDefault()
// OpenFileDefault opens file with default app for that file type (os defined)
// It runs open on Mac, xdg-open on Linux, and start on Windows.
OpenFileDefault() error
// OpenFilesWith opens selected files with user-specified command.
OpenFilesWith()
// OpenFileWith opens file with given command.
// does not wait for command to finish in this routine (separate routine Waits)
OpenFileWith(command string) error
// DuplicateFiles makes a copy of selected files
DuplicateFiles()
// DuplicateFile creates a copy of given file -- only works for regular files, not
// directories
DuplicateFile() error
// DeleteFiles deletes any selected files or directories. If any directory is selected,
// all files and subdirectories in that directory are also deleted.
DeleteFiles()
// DeleteFilesImpl does the actual deletion, no prompts
DeleteFilesImpl()
// DeleteFile deletes this file
DeleteFile() error
// RenameFiles renames any selected files
RenameFiles()
// RenameFile renames file to new name
RenameFile(newpath string) error
// NewFiles makes a new file in selected directory
NewFiles(filename string, addToVCS bool)
// NewFile makes a new file in this directory node
NewFile(filename string, addToVCS bool)
// NewFolders makes a new folder in the given selected directory
NewFolders(foldername string)
// NewFolder makes a new folder (directory) in this directory node
NewFolder(foldername string)
// CopyFileToDir copies given file path into node that is a directory.
// This does NOT check for overwriting -- that must be done at higher level!
CopyFileToDir(filename string, perm os.FileMode)
// Shows file information about selected file(s)
ShowFileInfo()
}
Filer is an interface for file tree file actions that all [Node]s satisfy.
type FindLoc ¶ added in v0.2.0
type FindLoc int32 //enums:enum -trim-prefix FindLoc
FindLoc corresponds to the search scope
const ( // FindOpen finds in all open folders in the left file browser FindLocOpen FindLoc = iota // FindLocAll finds in all directories under the root path. can be slow for large file trees FindLocAll // FindLocFile only finds in the current active file FindLocFile // FindLocDir only finds in the directory of the current active file FindLocDir // FindLocNotTop finds in all open folders *except* the top-level folder FindLocNotTop )
const FindLocN FindLoc = 5
FindLocN is the highest valid value for type FindLoc, plus one.
func FindLocValues ¶ added in v0.2.0
func FindLocValues() []FindLoc
FindLocValues returns all possible values for the type FindLoc.
func (FindLoc) MarshalText ¶ added in v0.2.0
MarshalText implements the encoding.TextMarshaler interface.
func (*FindLoc) SetString ¶ added in v0.2.0
SetString sets the FindLoc value from its string representation, and returns an error if the string is invalid.
func (FindLoc) String ¶ added in v0.2.0
String returns the string representation of this FindLoc value.
func (*FindLoc) UnmarshalText ¶ added in v0.2.0
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Node ¶
type Node struct {
core.Tree
// Filepath is the full path to this file.
Filepath core.Filename `edit:"-" set:"-" json:"-" xml:"-" copier:"-"`
// Info is the full standard file info about this file.
Info fileinfo.FileInfo `edit:"-" set:"-" json:"-" xml:"-" copier:"-"`
// Buffer is the file buffer for editing this file.
Buffer *texteditor.Buffer `edit:"-" set:"-" json:"-" xml:"-" copier:"-"`
// FileRoot is the root [Tree] of the tree, which has global state.
FileRoot *Tree `edit:"-" set:"-" json:"-" xml:"-" copier:"-"`
// DirRepo is the version control system repository for this directory,
// only non-nil if this is the highest-level directory in the tree under vcs control.
DirRepo vcs.Repo `edit:"-" set:"-" json:"-" xml:"-" copier:"-"`
// RepoFiles has the version control system repository file status,
// providing a much faster way to get file status, vs. the repo.Status
// call which is exceptionally slow.
RepoFiles vcs.Files `edit:"-" set:"-" json:"-" xml:"-" copier:"-"`
}
Node represents a file in the file system, as a core.Tree node. The name of the node is the name of the file. Folders have children containing further nodes.
func AsNode ¶
AsNode returns the given value as a value of type Node if the type of the given value embeds Node, or nil otherwise
func NewNode ¶
NewNode returns a new Node with the given optional parent: Node represents a file in the file system, as a core.Tree node. The name of the node is the name of the file. Folders have children containing further nodes.
func (*Node) AddToVCSSel ¶
func (fn *Node) AddToVCSSel()
AddToVCSSel adds selected files to version control system
func (*Node) AsFileNode ¶ added in v0.2.1
func (*Node) BlameVCS ¶
BlameVCS shows the VCS blame report for this file, reporting for each line the revision and author of the last change.
func (*Node) BlameVCSSel ¶
func (fn *Node) BlameVCSSel()
BlameVCSSel shows the VCS blame report for this file, reporting for each line the revision and author of the last change.
func (*Node) CloseBuf ¶
CloseBuf closes the file in its buffer if it is open. returns true if closed.
func (*Node) CommitToVCS ¶
CommitToVCS commits file changes to version control system
func (*Node) CommitToVCSSel ¶
func (fn *Node) CommitToVCSSel()
CommitToVCSSel commits to version control system based on last selected file
func (*Node) ContextMenu ¶
func (*Node) CopyFileToDir ¶
CopyFileToDir copies given file path into node that is a directory. This does NOT check for overwriting -- that must be done at higher level!
func (*Node) Cut ¶
func (fn *Node) Cut()
Cut copies the selected files to the clipboard and then deletes them.
func (*Node) DeleteFiles ¶
func (fn *Node) DeleteFiles()
deletes any selected files or directories. If any directory is selected, all files and subdirectories in that directory are also deleted.
func (*Node) DeleteFilesImpl ¶
func (fn *Node) DeleteFilesImpl()
DeleteFilesImpl does the actual deletion, no prompts
func (*Node) DeleteFromVCS ¶
func (fn *Node) DeleteFromVCS()
DeleteFromVCS removes file from version control
func (*Node) DeleteFromVCSSel ¶
func (fn *Node) DeleteFromVCSSel()
DeleteFromVCSSel removes selected files from version control system
func (*Node) DetectVCSRepo ¶
DetectVCSRepo detects and configures DirRepo if this directory is root of a VCS repository. if updateFiles is true, gets the files in the dir. returns true if a repository was newly found here.
func (*Node) DiffVCS ¶
DiffVCS shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffEditorDialog.
func (*Node) DiffVCSSel ¶
DiffVCSSel shows the diffs between two versions of selected files, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffEditorDialog.
func (*Node) DirFileList ¶ added in v0.2.1
DirFileList returns the list of files in this directory, sorted according to DirsOnTop and SortByModTime options
func (*Node) DirsTo ¶
DirsTo opens all the directories above the given filename, and returns the node for element at given path (can be a file or directory itself -- not opened -- just returned)
func (*Node) DropDeleteSource ¶
Dragged is called after target accepts the drop -- we just remove elements that were moved satisfies core.DragNDropper interface and can be overridden by subtypes
func (*Node) DuplicateFile ¶
DuplicateFile creates a copy of given file -- only works for regular files, not directories
func (*Node) DuplicateFiles ¶
func (fn *Node) DuplicateFiles()
DuplicateFiles makes a copy of selected files
func (*Node) FileExtCounts ¶
func (fn *Node) FileExtCounts(cat fileinfo.Categories) []NodeNameCount
FileExtCounts returns a count of all the different file extensions, sorted from highest to lowest. If cat is != fileinfo.Unknown then it only uses files of that type (e.g., fileinfo.Code to find any code files)
func (*Node) FilesMatching ¶
FilesMatching returns list of all nodes whose file name contains given string (no regexp). ignoreCase transforms everything into lowercase
func (*Node) FindDirNode ¶
FindDirNode finds directory node by given path. Must be a relative path already rooted at tree, or absolute path within tree.
func (*Node) FindFile ¶
FindFile finds first node representing given file (false if not found) -- looks for full path names that have the given string as their suffix, so you can include as much of the path (including whole thing) as is relevant to disambiguate. See FilesMatching for a list of files that match a given string.
func (*Node) FirstVCS ¶
FirstVCS returns the first VCS repository starting from this node and going down. also returns the node having that repository
func (*Node) IsAutoSave ¶
IsAutoSave returns true if file is an auto-save file (starts and ends with #)
func (*Node) IsChanged ¶
IsChanged returns true if the file is open and has been changed (edited) since last EditDone
func (*Node) IsExternal ¶
IsExternal returns true if file is external to main file tree
func (*Node) IsIrregular ¶
IsIrregular returns true if file is a special "Irregular" node
func (*Node) IsNotSaved ¶
IsNotSaved returns true if the file is open and has been changed (edited) since last Save
func (*Node) LatestFileMod ¶
func (fn *Node) LatestFileMod(cat fileinfo.Categories) time.Time
LatestFileMod returns the most recent mod time of files in the tree. If cat is != fileinfo.Unknown then it only uses files of that type (e.g., fileinfo.Code to find any code files)
func (*Node) LogVCS ¶
LogVCS shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLog which supports further actions.
func (*Node) LogVCSSel ¶
func (fn *Node) LogVCSSel()
LogVCSSel shows the VCS log of commits for selected files.
func (*Node) MimeData ¶
MimeData adds mimedata for this node: a text/plain of the Path, text/plain of filename, and text/
func (*Node) NewFolders ¶
makes a new folder in the given selected directory
func (*Node) OpenBuf ¶
OpenBuf opens the file in its buffer if it is not already open. returns true if file is newly opened
func (*Node) OpenFileDefault ¶
OpenFileDefault opens file with default app for that file type (os defined) runs open on Mac, xdg-open on Linux, and start on Windows
func (*Node) OpenFileWith ¶
OpenFileWith opens file with given command. does not wait for command to finish in this routine (separate routine Waits)
func (*Node) OpenFilesDefault ¶
func (fn *Node) OpenFilesDefault()
OpenFilesDefault opens selected files with default app for that file type (os defined). runs open on Mac, xdg-open on Linux, and start on Windows
func (*Node) OpenFilesWith ¶
func (fn *Node) OpenFilesWith()
OpenFilesWith opens selected files with user-specified command.
func (*Node) PasteCheckExisting ¶
func (fn *Node) PasteCheckExisting(tfn *Node, md mimedata.Mimes, externalDrop bool) ([]string, *Node)
PasteCheckExisting checks for existing files in target node directory if that is non-nil (otherwise just uses absolute path), and returns list of existing and node for last one if exists.
func (*Node) PasteCopyFiles ¶
PasteCopyFiles copies files in given data into given target directory
func (*Node) PasteCopyFilesCheck ¶
func (fn *Node) PasteCopyFilesCheck(tdir *Node, md mimedata.Mimes, externalDrop bool, dropFinal func())
PasteCopyFilesCheck copies files into given directory node, first checking if any already exist -- if they exist, prompts.
func (*Node) PasteFiles ¶
PasteFiles applies a paste / drop of mime data onto this node. always does a copy of files into / onto target. externalDrop is true if this is an externally generated Drop event (from OS)
func (*Node) RemoveFromExterns ¶
func (fn *Node) RemoveFromExterns()
RemoveFromExterns removes file from list of external files
func (*Node) RenameFile ¶
RenameFile renames file to new name
func (*Node) Repo ¶
Repo returns the version control repository associated with this file, and the node for the directory where the repo is based. Goes up the tree until a repository is found.
func (*Node) RevertVCSSel ¶
func (fn *Node) RevertVCSSel()
RevertVCSSel removes selected files from version control system
func (*Node) SelectedFunc ¶ added in v0.2.0
SelectedFunc runs the given function on all selected nodes in reverse order.
func (*Node) SetFileIcon ¶
func (fn *Node) SetFileIcon()
func (*Node) ShowFileInfo ¶
func (fn *Node) ShowFileInfo()
Shows file information about selected file(s)
func (*Node) SortBy ¶
SortBy determines how to sort the files in the directory -- default is alpha by name, optionally can be sorted by modification time.
func (*Node) SortBys ¶
SortBys determines how to sort the selected files in the directory. Default is alpha by name, optionally can be sorted by modification time.
func (*Node) UpdateAllVCS ¶
func (fn *Node) UpdateAllVCS()
UpdateAllVCS does an update on any repositories below this one in file tree
func (*Node) UpdateRepoFiles ¶
func (fn *Node) UpdateRepoFiles()
func (*Node) VCSContextMenu ¶
type NodeEmbedder ¶
type NodeEmbedder interface {
AsNode() *Node
}
NodeEmbedder is an interface that all types that embed Node satisfy
type NodeNameCount ¶
NodeNameCount is used to report counts of different string-based things in the file tree
type SearchResults ¶ added in v0.2.0
SearchResults is used to report search results
func FindAll ¶ added in v0.2.0
func FindAll(start *Node, find string, ignoreCase, regExp bool, langs []fileinfo.Known, openPath func(path string) *Node) []SearchResults
FindAll returns list of all files (regardless of what is currently open) starting at given node of given language(s) that contain the given string, sorted in descending order by number of occurrences. ignoreCase transforms everything into lowercase.
func Search ¶ added in v0.2.0
func Search(start *Node, find string, ignoreCase, regExp bool, loc FindLoc, activeDir string, langs []fileinfo.Known, openPath func(path string) *Node) []SearchResults
Search returns list of all nodes starting at given node of given language(s) that contain the given string, sorted in descending order by number of occurrences -- ignoreCase transforms everything into lowercase
type Tree ¶
type Tree struct {
Node
// ExternalFiles are external files outside the root path of the tree.
// They are stored in terms of their absolute paths. These are shown
// in the first sub-node if present; use [Tree.AddExternalFile] to add one.
ExternalFiles []string `set:"-"`
// records state of directories within the tree (encoded using paths relative to root),
// e.g., open (have been opened by the user) -- can persist this to restore prior view of a tree
Dirs DirFlagMap `set:"-"`
// if true, then all directories are placed at the top of the tree.
// Otherwise everything is mixed.
DirsOnTop bool
// type of node to create; defaults to [Node] but can use custom node types
FileNodeType *types.Type `display:"-" json:"-" xml:"-"`
// contains filtered or unexported fields
}
Tree is the root widget of a file tree representing files in a given directory (and subdirectories thereof), and has some overall management state for how to view things.
func NewTree ¶
NewTree returns a new Tree with the given optional parent: Tree is the root widget of a file tree representing files in a given directory (and subdirectories thereof), and has some overall management state for how to view things.
func (*Tree) AddExternalFile ¶ added in v0.2.0
AddExternalFile adds an external file outside of root of file tree and triggers an update, returning the Node for it, or error if filepath.Abs fails.
func (*Tree) ConfigWatcher ¶
ConfigWatcher configures a new watcher for tree
func (*Tree) DirSortByModTime ¶
DirSortByModTime returns true if dir is sorted by mod time
func (*Tree) DirSortByName ¶
DirSortByName returns true if dir is sorted by name
func (*Tree) ExternalNodeByPath ¶ added in v0.2.0
ExternalNodeByPath returns Node for given file path, and true, if it exists in the external files list. Otherwise returns nil, false.
func (*Tree) HasExternalFile ¶ added in v0.2.0
HasExternalFile returns true and index if given abs path exists on ExtFiles list. false and -1 if not.
func (*Tree) IsDirOpen ¶
IsDirOpen returns true if given directory path is open (i.e., has been opened in the view)
func (*Tree) OpenPath ¶
OpenPath opens the filetree at the given directory path. It reads all the files at the given path into this tree. Only paths listed in [Tree.Dirs] will be opened.
func (*Tree) RemoveExternalFile ¶ added in v0.2.0
RemoveExternalFile removes external file from maintained list; returns true if removed.
func (*Tree) SetDirClosed ¶
SetDirClosed sets the given directory path to be closed
func (*Tree) SetDirOpen ¶
SetDirOpen sets the given directory path to be open
func (*Tree) SetDirSortBy ¶
SetDirSortBy sets the given directory path sort by option
func (*Tree) SetDirsOnTop ¶
SetDirsOnTop sets the [Tree.DirsOnTop]: if true, then all directories are placed at the top of the tree. Otherwise everything is mixed.
func (*Tree) SetFileNodeType ¶ added in v0.0.10
SetFileNodeType sets the [Tree.FileNodeType]: type of node to create; defaults to Node but can use custom node types
func (*Tree) UnWatchPath ¶
UnWatchPath removes given path from those watched
func (*Tree) UpdatePath ¶
UpdatePath updates the tree at the directory level for given path and everything below it. It flags that it needs render update, but if a deletion or insertion happened, then NeedsLayout should also be called.
func (*Tree) WatchUpdate ¶ added in v0.0.10
WatchUpdate does the update for given path
func (*Tree) WatchWatcher ¶
func (ft *Tree) WatchWatcher()
WatchWatcher monitors the watcher channel for update events. It must be called once some paths have been added to watcher -- safe to call multiple times.
type VCSLog ¶ added in v0.2.0
type VCSLog struct {
core.Frame
// current log
Log vcs.Log
// file that this is a log of -- if blank then it is entire repository
File string
// date expression for how long ago to include log entries from
Since string
// version control system repository
Repo vcs.Repo `json:"-" xml:"-" copier:"-"`
// revision A -- defaults to HEAD
RevA string `set:"-"`
// revision B -- blank means current working copy
RevB string `set:"-"`
// double-click will set the A revision -- else B
SetA bool
}
VCSLog is a widget that represents VCS log data.
func NewVCSLog ¶ added in v0.2.0
NewVCSLog returns a new VCSLog with the given optional parent: VCSLog is a widget that represents VCS log data.
func (*VCSLog) MakeToolbar ¶ added in v0.2.0
func (*VCSLog) SetFile ¶ added in v0.2.0
SetFile sets the [VCSLog.File]: file that this is a log of -- if blank then it is entire repository
func (*VCSLog) SetRepo ¶ added in v0.2.0
SetRepo sets the [VCSLog.Repo]: version control system repository
func (*VCSLog) SetSetA ¶ added in v0.2.0
SetSetA sets the [VCSLog.SetA]: double-click will set the A revision -- else B
func (*VCSLog) SetSince ¶ added in v0.2.0
SetSince sets the [VCSLog.Since]: date expression for how long ago to include log entries from
type VersionControlName ¶ added in v0.0.8
type VersionControlName string
VersionControlName is the name of a version control system
func VersionControlNameProper ¶ added in v0.0.8
func VersionControlNameProper(vc string) VersionControlName
func (VersionControlName) Value ¶ added in v0.0.8
func (kn VersionControlName) Value() core.Value
Value registers core.Chooser as the core.Value widget for VersionControlName