create

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: 13 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 create provides the command to create labels.

Index

Constants

This section is empty.

Variables

View Source
var CreateCmd = &cobra.Command{
	Use:     "create --name <label-name>",
	Short:   "Create a new label in the repository.",
	Example: `  contextvibes project labels create --name "docs" --description "Documentation updates" --color "0075ca"`,
	RunE: func(cmd *cobra.Command, _ []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		ctx := cmd.Context()

		if strings.TrimSpace(labelName) == "" {

			return errors.New("label name cannot be empty, please provide the --name flag")
		}

		provider, err := newProvider(ctx, globals.AppLogger, globals.LoadedAppConfig)
		if err != nil {
			presenter.Error("Failed to initialize work item provider: %v", err)

			return err
		}

		newLabel := workitem.Label{
			Name:        labelName,
			Description: labelDescription,
			Color:       labelColor,
		}

		presenter.Summary("Creating label '%s'...", newLabel.Name)

		_, err = provider.CreateLabel(ctx, newLabel)
		if err != nil {
			presenter.Error("Failed to create label: %v", err)

			return fmt.Errorf("failed to create label: %w", err)
		}

		presenter.Success("Successfully created label '%s'.", newLabel.Name)

		return nil
	},
}

CreateCmd represents the project labels create 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