workspace

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a new workspace",
	Long:  `Create a new workspace with selected tasks`,
	Run: func(cmd *cobra.Command, args []string) {
		source, _ := cmd.Flags().GetString("from-json")
		if source != "" {
			workspaces, err := repository.ReadJSONSource[[]models.Workspace](source)
			if err != nil {
				styles.PrintError(fmt.Sprintf("Failed to read source: %v", err))
				os.Exit(1)
			}

			if err := repository.ImportWorkspaces(workspaces); err != nil {
				styles.PrintError(fmt.Sprintf("Import failed:\n%v", err))
				os.Exit(1)
			}

			styles.PrintSuccess(fmt.Sprintf("%d workspace(s) imported successfully!", len(workspaces)))
			os.Exit(0)
		}

		if err := CreateWorkspaceCommand(); err != nil {
			styles.PrintError(fmt.Sprintf("Failed to create workspace: %v", err))
		}
	},
}

createWorkspaceCmd creates a new workspace, or imports workspaces from JSON when --from-json is set.

View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete <name>",
	Short: "Delete a workspace",
	Long:  `Delete a workspace with the specified name`,
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		workspaceName := args[0]

		if _, err := repository.FindWorkspaceByName(workspaceName); err != nil {
			styles.PrintError(fmt.Sprintf("Workspace '%s' not found", workspaceName))
			return
		}

		if err := repository.DeleteWorkspace(workspaceName); err != nil {
			styles.PrintError(fmt.Sprintf("Failed to delete workspace '%s': %v", workspaceName, err))
			return
		}

		styles.PrintSuccess(fmt.Sprintf("Workspace '%s' deleted successfully!", workspaceName))
	},
}

DeleteCmd deletes a workspace specified by name.

View Source
var EditCmd = &cobra.Command{
	Use:   "edit <name>",
	Short: "Edit an existing workspace",
	Long:  `Edit an existing workspace with the specified name`,
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		workspaceName := args[0]

		if err := EditWorkspaceCommand(workspaceName); err != nil {
			styles.PrintError(fmt.Sprintf("Failed to edit workspace '%s': %v", workspaceName, err))
		}
	},
}

EditCmd opens the TUI form to edit an existing workspace.

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List all workspaces",
	Long:  `Display a list of all configured workspaces`,
	Run: func(cmd *cobra.Command, args []string) {

		styles.PrintInfo("Workspace listing not yet implemented")
	},
}

listWorkspacesCmd lists all saved workspaces

View Source
var RunCmd = &cobra.Command{
	Use:               "run <name>",
	Short:             "Run a workspace",
	Long:              `Execute all tasks defined in a workspace`,
	Args:              cobra.ExactArgs(1),
	ValidArgsFunction: completeWorkspaceNames,
	Run: func(cmd *cobra.Command, args []string) {
		workspaceName := args[0]

		runner, err := vscode.NewRunner()
		if err != nil {
			styles.PrintError(fmt.Sprintf("Failed to connect to secure VSCode: %v", err))
			return
		}

		if err := runner.RunWorkspace(workspaceName); err != nil {
			styles.PrintError(fmt.Sprintf("Error running workspace: %v", err))
			return
		}
	},
}

RunCmd runs a workspace by name

Functions

func CreateWorkspaceCommand

func CreateWorkspaceCommand() error

CreateWorkspaceCommand creates a new workspace using the TUI form.

func EditWorkspaceCommand

func EditWorkspaceCommand(workspaceName string) error

EditWorkspaceCommand edits an existing workspace using the TUI form.

func NewEditWorkspaceModel

func NewEditWorkspaceModel(workspace *models.Workspace) tea.Model

NewEditWorkspaceModel creates a workspace editing form with pre-filled data.

func NewWorkspaceModel

func NewWorkspaceModel() tea.Model

NewWorkspaceModel creates a new workspace creation form.

Types

type WorkspaceModel

type WorkspaceModel struct {
	// contains filtered or unexported fields
}

WorkspaceModel represents the form for creating/editing workspaces.

func (*WorkspaceModel) Init

func (w *WorkspaceModel) Init() tea.Cmd

Init initializes the workspace form model.

func (*WorkspaceModel) Update

func (w *WorkspaceModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the workspace form state.

func (*WorkspaceModel) View

func (w *WorkspaceModel) View() string

View renders the workspace form.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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