Documentation
¶
Overview ¶
Package projects is the named groups of folders of this computer sessions work in, such as a repository and the ones always opened with it: kept once for every profile in projects.json of the folder they share, each with a slug branches and commands name it by and a main folder its sessions and task worktrees start in. A session is in the project whose folder holds its own, the innermost winning, and a profile's sessions start in the main folder of the project it works in when nothing names a folder. Features that keep boards of tasks bind them to projects through hooks, and hear as sessions move into projects and projects change
Index ¶
- func Branch(slug, task, title string) string
- func Slug(text string) (string, error)
- type Archived
- type Board
- type Change
- type Entered
- type Folder
- type Hooks
- type Moved
- type Project
- type Projects
- func (p *Projects) Active(cfg *config.Config) (Project, bool)
- func (p *Projects) AddFolder(ctx context.Context, id, path, label string, main bool) (Project, error)
- func (p *Projects) Archive(ctx context.Context, id string, archive bool) (Archived, error)
- func (p *Projects) Bind(ctx context.Context, board, id string) error
- func (p *Projects) Boards(id string) ([]Board, error)
- func (p *Projects) Create(ctx context.Context, spec Spec) (Project, error)
- func (p *Projects) Delete(ctx context.Context, id string) error
- func (p *Projects) Enter(ctx context.Context, cfg *config.Config, session string, project Project) (Entered, error)
- func (p *Projects) Folder(cfg *config.Config) string
- func (p *Projects) Get(ref string) (Project, error)
- func (p *Projects) Guarding(unreadable func(cfg *config.Config, path string) string)
- func (p *Projects) Label(ctx context.Context, id, path, label string) (Project, error)
- func (p *Projects) List(archived bool) ([]Project, error)
- func (p *Projects) Move(ctx context.Context, cfg *config.Config, session, folder string, near bool) (Entered, error)
- func (p *Projects) Moving(fn func(ctx context.Context, cfg *config.Config, moved Moved))
- func (p *Projects) Of(path string) (Project, bool)
- func (p *Projects) Register(registrant Registrant)
- func (p *Projects) RemoveFolder(ctx context.Context, id, path string) (Project, error)
- func (p *Projects) SetMain(ctx context.Context, id, path string) (Project, error)
- func (p *Projects) Snapshot() (Snapshot, error)
- func (p *Projects) Update(ctx context.Context, id string, change Change) (Project, error)
- func (p *Projects) Use(cfg *config.Config, id string) error
- type Registrant
- type Registry
- type Snapshot
- type Spec
- type Taken
- type Unknown
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Archived ¶
What archiving or restoring a project did: the project as kept, the boards that were bound to it, and the profiles that worked in it
type Board ¶
type Board struct {
Slug, Name string
// Id of the project the board's new tasks are linked to, empty for none
Project string
}
A board of tasks a feature keeps, such as one of the task board, which a project can be bound to
type Change ¶
type Change struct {
Name, Description, Icon *string
}
Fields of a project to change, nil keeping what it holds
type Entered ¶
type Entered struct {
// Folder the session works in now
Folder string
// It worked in a folder of the project already and stayed there
Stayed bool
// What happened, line by line, for the person
Lines []string
}
What moving a session into a project did
type Folder ¶
type Folder struct {
// Whole path, its links resolved
Path string `json:"path"`
// What the folder is to the project, such as web, empty for none
Label string `json:"label,omitempty"`
Added time.Time `json:"added_at"`
}
A folder of a project
type Hooks ¶
type Hooks struct {
// Boards of tasks the feature keeps that are not archived, each with the project it is bound to
Boards func() ([]Board, error)
// Binds the board of the slug to the project of the id, so the board's new tasks are linked to it from then on, or to none for an empty
// id
Bind func(ctx context.Context, board, project string) error
// Binds the board of the slug to none while it is bound to the project of the id, as a project archived or deleted lets go of its
// boards, a board bound to another since left as it is: whether it was let go of. A binding to none stands in where it is nil
Unbind func(ctx context.Context, board, project string) (bool, error)
// Hears that a session moved into a project or a project changed, such as to show again the project each session works in
Changed func(ctx context.Context)
}
What a feature that works with projects adds to them, each part left nil when it has none
type Moved ¶
type Moved struct {
Session, From, To string
// Git branch and repository root of the folder it works in now, and the id and name of the project the folder lies in, empty for none
Branch, Root, Project, Title string
}
What a session moving to another folder came to, as what follows sessions hears of it
type Project ¶
type Project struct {
// p_ and eight hex digits
ID string `json:"id"`
// Lower case handle commands, branches and the task board name it by, never changed
Slug string `json:"slug"`
Name string `json:"name"`
// What it is for, empty when nothing is said
Description string `json:"description,omitempty"`
// Short mark shown before its name, such as an emoji, empty for none
Icon string `json:"icon,omitempty"`
// Main folder first, then the others in the order they were added; never empty
Folders []Folder `json:"folders"`
Created time.Time `json:"created_at"`
// Hidden from the lists and holding no session until it is restored
Archived bool `json:"archived,omitempty"`
}
A named group of folders of this computer sessions work in
type Projects ¶
type Projects struct {
Registry
// contains filtered or unexported fields
}
func (*Projects) Active ¶
Active returns the live project that Start project names, and false for none.
func (*Projects) AddFolder ¶
func (p *Projects) AddFolder(ctx context.Context, id, path, label string, main bool) (Project, error)
Adds the folder, a whole path, to the project of the id with its label, as its main folder when asked
func (*Projects) Archive ¶
Archives the project of the id, its boards bound to no project and no profile working in it any longer, or restores it
func (*Projects) Bind ¶
Binds the board of tasks of the slug to the project of the id, which must not be archived, or to none for an empty id
func (*Projects) Delete ¶
Deletes the archived project of the id for good, its folders and the tasks linked to it left as they are
func (*Projects) Enter ¶
func (p *Projects) Enter(ctx context.Context, cfg *config.Config, session string, project Project) (Entered, error)
Moves the session of the profile of the settings into the main folder of the project, the folder of its commands with it wherever the place they run in reaches that folder, the lines of what happened saying where they start; a session in a folder of the project already stays. An error means the session did not move
func (*Projects) Folder ¶
Main folder of the project the profile of the settings works in, where its sessions start when nothing names a folder; empty for none, or for a main folder gone from this computer
func (*Projects) Get ¶
Project the text names, archived ones too: its id, else its slug, else its name in any case; an *Unknown when none does, and an error naming their slugs when several projects have the name
func (*Projects) Guarding ¶
Hands over why the tools of a profile may not read a path, empty when they may, which a session may not move into a folder against
func (*Projects) Label ¶
Gives the folder of the project of the id the label, such as web, or none for an empty one
func (*Projects) Move ¶
func (p *Projects) Move(ctx context.Context, cfg *config.Config, session, folder string, near bool) (Entered, error)
Moves a session of the profile of the settings to a folder under the rules of a person's /cd: a folder of this computer that is there, that the profile's guard of the tools lets be read, for a session whose folder no one else names, as a code editor names the folder of a session it shows and a session that works for another works where that one gave it. Near keeps the move to folders inside the one the session works in and those of the projects, as for a person in a chat app or an extension. Its commands follow, and every feature hears of it. An error says in words why it did not move
func (*Projects) Moving ¶
Hands over what hears of each session that moved to another folder, such as the hook point on_session_move
func (*Projects) Of ¶
Project not archived one of whose folders holds the path, its links resolved, the innermost folder winning; false for none
func (*Projects) Register ¶
func (p *Projects) Register(registrant Registrant)
Adds a registrant; a registry nested in the host reaches it through Host
func (*Projects) RemoveFolder ¶
Takes the folder out of the project of the id, the folder itself left as it is; the next folder becomes the main one when it was
func (*Projects) Snapshot ¶
Projects as the file holds them now, none when there is no file or it holds nothing, read again only once the file changed: a caller that only reads looks projects up in it with no copy of them all
type Registrant ¶
type Registrant interface {
Hooks() Hooks
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Hooks ¶
Hooks of every registrant: the boards of them all, a binding and a letting go by the one that keeps the board, and every hearing in turn
func (*Registry) Host ¶
Host the registry is nested in, through which plugins find, change and enter projects
func (*Registry) Register ¶
func (r *Registry) Register(registrant Registrant)
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
The projects as projects.json held them at one read, oldest first, shared by every read of it and never changed in place, with the place of each among them by its id
type Spec ¶
type Spec struct {
Name string
// Slug it is named by, made from the name when empty
Slug string
Description string
Icon string
// Whole paths of its folders, a leading ~ standing for the home folder, the first its main folder
Folders []string
// Board of tasks bound to it once it is made, none when empty
Board string
// Asked with the main folder as it is kept, its links resolved, once every check the projects as they are allow passed and before
// anything is made, such as for the user's approval: its error is answered as it is and nothing is made; nil asks nothing
Allow func(main string) error
}
What a new project is made of