workspaceswitch

package
v0.26.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(factory framework.Factory) (*cobra.Command, framework.Runner)

NewCommand creates a new Cobra command and a Runner to switch the current workspace, taking in a Factory as a parameter and setting the command's usage, short description, long description, example, arguments, and RunE.

Types

type Runner

type Runner struct {
	ConfigHolder        *framework.ConfigHolder
	ConfigFileInterface framework.ConfigFileInterface
	Output              output.Interface
	WorkspaceName       string
}

Runner is the runner implementation for the `rad workspace switch` command.

func NewRunner

func NewRunner(factory framework.Factory) *Runner

NewRunner creates a new instance of the `rad workspace switch` runner.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run checks if the default workspace is already set to the given workspace name, and if not, switches the default workspace to the given workspace name. It returns an error if the workspace name is invalid or if there is an issue setting the default workspace.

func (*Runner) Validate

func (r *Runner) Validate(cmd *cobra.Command, args []string) error

Validate reads the workspace name from the command line arguments, checks if it is empty, and if not, checks if the workspace exists. If the workspace does not exist, an error is returned.

Jump to

Keyboard shortcuts

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