run

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

cmd/product/run/run.go

Index

Constants

This section is empty.

Variables

View Source
var RunCmd = &cobra.Command{
	Use:     "run",
	Example: `  contextvibes product run`,
	RunE: func(cmd *cobra.Command, args []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		ctx := cmd.Context()

		presenter.Header("--- Example Runner ---")

		examples, err := findRunnableExamples(".")
		if err != nil {
			return err
		}
		if len(examples) == 0 {
			presenter.Warning("No runnable examples found in the './examples' directory.")

			return nil
		}

		choice, err := presenter.PromptForSelect("Please select an example to run:", examples)
		if err != nil || choice == "" {
			return nil
		}

		if err := runVerificationChecks(ctx, presenter, globals.ExecClient, globals.LoadedAppConfig, choice); err != nil {
			return errors.New("prerequisite verification failed")
		}

		presenter.Newline()
		presenter.Step("Executing example: %s...", presenter.Highlight(choice))
		err = globals.ExecClient.Execute(ctx, ".", "go", "run", "./"+choice)
		if err != nil {
			return errors.New("example execution failed")
		}

		globals.AppLogger.InfoContext(ctx, "Successfully launched example", "example_path", choice)

		return nil
	},
}

RunCmd represents the run command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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