run

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 12 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

Overview

Package run provides the command to execute example applications.

Index

Constants

This section is empty.

Variables

View Source
var RunCmd = &cobra.Command{
	Use:     "run",
	Example: `  contextvibes product run`,
	RunE: func(cmd *cobra.Command, _ []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
		}

		err = runVerificationChecks(ctx, presenter, globals.ExecClient, globals.LoadedAppConfig, choice)
		if 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