workspace

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package workspace manages multiple cloop projects registered in a global registry. The registry is stored in ~/.config/cloop/workspaces.json (respecting XDG_CONFIG_HOME).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(name, path, description string) error

Add registers a workspace with the given name and path. If a workspace with the same name already exists it is updated. The path is resolved to an absolute path before storing.

func GetActive

func GetActive() string

GetActive returns the currently active workspace name, or "" if none is set.

func Remove

func Remove(name string) error

Remove unregisters the workspace with the given name. Returns nil if the workspace does not exist (idempotent).

func ResolveWorkDir

func ResolveWorkDir(name string) (string, error)

ResolveWorkDir returns the working directory for the given workspace name. If name is empty, the current working directory is returned.

func SetActive

func SetActive(name string) error

SetActive persists the active workspace name. Pass "" to clear.

func Switch

func Switch(name string) error

Switch sets the given workspace as the active one and writes a .cloop_workspace pointer file inside the workspace directory as a local breadcrumb.

Types

type Workspace

type Workspace struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Description string `json:"description,omitempty"`
}

Workspace represents a registered cloop project.

func Get

func Get(name string) (*Workspace, error)

Get returns the workspace with the given name, or an error if not found.

func List

func List() ([]Workspace, error)

List returns all registered workspaces.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL