worksession

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const WorkSessionEnvVar = "ALPACON_WORK_SESSION"

WorkSessionEnvVar is the environment variable consulted as a fallback when no --work-session flag is given. Resolution order: flag > env var > config.

Variables

View Source
var WorkSessionCmd = &cobra.Command{
	Use:     "work-session",
	Aliases: []string{"session"},
	Short:   "Create and manage work sessions",
	Long:    "Create, inspect, and manage work sessions—the approval-gated units that group Websh, WebFTP, and exec access on Alpacon.",
	RunE: func(cmd *cobra.Command, args []string) error {
		if err := cmd.Help(); err != nil {
			return err
		}
		return errors.New("a subcommand is required. Use 'alpacon work-session ls', 'alpacon work-session create', 'alpacon work-session describe', 'alpacon work-session use', 'alpacon work-session current', 'alpacon work-session activate', 'alpacon work-session complete', 'alpacon work-session extend', 'alpacon work-session approve', 'alpacon work-session reject', 'alpacon work-session revoke', 'alpacon work-session timeline', or 'alpacon work-session recording'. Run 'alpacon work-session --help' for more information")
	},
}

Functions

func AnnounceIfActive

func AnnounceIfActive(uuid string)

AnnounceIfActive prints "Using work-session <uuid>" to stderr when uuid is non-empty. Stderr keeps stdout clean for --output json.

func MarkActive

func MarkActive(rows []wsapi.WorkSessionAttributes, activeUUID string)

MarkActive decorates the row whose ID matches activeUUID with a "*" marker in its Active column. No-op when activeUUID is empty or no row matches. Exported for unit testing; safe to call with a nil/empty slice.

func Resolve

func Resolve(flagValue string) (string, error)

Resolve returns the effective work-session UUID using flag > env var > config priority.

func ResolveAndAnnounce

func ResolveAndAnnounce(flagValue string) string

ResolveAndAnnounce resolves the work-session UUID, announces it, and exits on error.

func RunCurrent

func RunCurrent(ac *client.AlpaconClient) (string, *wsapi.WorkSession, error)

RunCurrent returns the active work-session UUID and its server-side details. Returns ("", nil, nil) when nothing is set, or (uuid, nil, err) if set but unreachable.

func RunUnset

func RunUnset() error

RunUnset clears the active work-session for the current workspace. Idempotent — no error when nothing is set.

func RunUse

func RunUse(ac *client.AlpaconClient, uuid string) (string, error)

RunUse validates the work-session via the server, then stores it in config. Returns the human-readable description on success.

Types

This section is empty.

Jump to

Keyboard shortcuts

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