Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchRepoFolders ¶
func FetchRepoFolders(opts GitFetchOptions) error
FetchRepoFolders fetches and downloads specified folders from a GitHub repo
func StartTerminalStream ¶ added in v0.4.2
func WriteToTerminal ¶ added in v0.4.2
Types ¶
type DirToJSONOptions ¶ added in v0.4.2
type DirToJSONOptions struct {
PrintJSON bool // If true, print the resulting JSON to stdout
}
DirToJSONOptions defines optional parameters for DirToJSON.
type FileNode ¶
type FileNode struct {
Name string `json:"name"` // The name of the file or directory
IsDir bool `json:"isDir"` // True if this node is a directory
Children []*FileNode `json:"children,omitempty"` // Child nodes (only if IsDir is true)
}
FileNode represents a single file or directory in a hierarchical structure. It will be serialized into JSON.
func DirToJSON ¶
func DirToJSON(root string, options *DirToJSONOptions) (*FileNode, error)
DirToJSON converts a directory structure into a tree of FileNode objects. It recursively scans the given root directory and builds a tree representation, which can be serialized into JSON.
Parameters:
- root: string — The full path of the directory or file to scan.
- options: optional settings (e.g., PrintJSON)
Returns:
- *FileNode — A pointer to the root FileNode struct representing the file or folder hierarchy.
- error — An error if something went wrong while accessing the filesystem.
Example:
Calling DirToJSON("myfolder") might output:
{
"name": "myfolder",
"isDir": true,
"children": [
{
"name": "file1.txt",
"isDir": false
},
{
"name": "subdir",
"isDir": true,
"children": [
{
"name": "nested.txt",
"isDir": false
}
]
}
]
}
type GitFetchOptions ¶
type GitFetchOptions struct {
RepoURL string
Branch string
DestinationPath string
Folders []string
PullOnlyFolders bool
Overwrite bool
OnProgress ProgressHandler
}
GitFetchOptions defines options for fetching a GitHub repository
type ProgressHandler ¶
type TerminalSession ¶ added in v0.4.2
type TerminalSession struct {
IsActive bool
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.