Documentation
¶
Overview ¶
////////////////////////////////////////////////////////////////////////////// //////// Maintains a list of projects visited by the user. /////////////////// //////// Author: drellem Date: 2022-10-15 /////////////////// //////////////////////////////////////////////////////////////////////////////
Index ¶
- Variables
- func Add(p *Project)
- func AddAll(ps []Project)
- func GetProject(id int) *search.IndexedProject
- func IndexAll()
- func Init()
- func NotifyProjectAdded(projectPath string)
- func Remove(path string) bool
- func RemoveSaveFile()
- func SaveProjects()
- func StartScanner() error
- func StopScanner()
- func Visit(req VisitRequest) (*VisitResponse, *ErrorResponse)
- type ErrorResponse
- type Project
- type ProjectStatusResponse
- type ProjectsSave
- type Scanner
- type VisitRequest
- type VisitResponse
Constants ¶
This section is empty.
Variables ¶
var ProjectFileName string
Functions ¶
func GetProject ¶
func GetProject(id int) *search.IndexedProject
func IndexAll ¶
func IndexAll()
IndexAll processes all loaded projects through plugins in the background. Call this after Init() and after the HTTP server is listening.
func NotifyProjectAdded ¶
func NotifyProjectAdded(projectPath string)
NotifyProjectAdded tells the scanner to watch the parent of a newly added project.
func Remove ¶ added in v0.1.1
Remove removes a project by path and persists the change. Returns true if the project was found and removed.
func RemoveSaveFile ¶
func RemoveSaveFile()
func SaveProjects ¶
func SaveProjects()
func StartScanner ¶
func StartScanner() error
StartScanner creates and starts the background repo scanner. Call after Init() so existing projects seed the watch list.
func Visit ¶
func Visit(req VisitRequest) (*VisitResponse, *ErrorResponse)
If the path is within an existing project, returns the project. Otherwise traverses parent directories and creates a project if one is found.
Types ¶
type ErrorResponse ¶
type Project ¶
func GetProjectByPath ¶
type ProjectStatusResponse ¶
type ProjectStatusResponse struct {
Id int `json:"id"`
Path string `json:"path"`
Status search.IndexingStatus `json:"indexing_status"`
FileCount int `json:"file_count"`
}
func GetProjectStatuses ¶
func GetProjectStatuses() []ProjectStatusResponse
type ProjectsSave ¶
type ProjectsSave struct {
Projects []Project `json:"projects"`
}
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner watches parent directories of known projects for new sibling repos. When a project at ~/src/foo is registered, Scanner watches ~/src/. If ~/src/bar appears with a .git directory, it gets auto-registered.
type VisitRequest ¶
type VisitRequest struct {
Path string `json:"path"`
}
type VisitResponse ¶
type VisitResponse struct {
ParentProject Project `json:"project"`
}