hook

package
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package hook provides the defined hook CLI commands for Vela.

Usage:

import "github.com/go-vela/cli/command/hook"

Index

Constants

This section is empty.

Variables

View Source
var CommandGet = &cli.Command{
	Name:        "hook",
	Aliases:     []string{"hooks"},
	Description: "Use this command to get a list of hooks.",
	Usage:       "Display a list of hooks",
	Action:      get,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "HOOK_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the hook",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "HOOK_REPO"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the hook",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "HOOK_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew, wide or yaml",
		},

		&cli.IntFlag{
			EnvVars: []string{"VELA_PAGE", "HOOK_PAGE"},
			Name:    internal.FlagPage,
			Aliases: []string{"p"},
			Usage:   "print a specific page of hooks",
			Value:   1,
		},
		&cli.IntFlag{
			EnvVars: []string{"VELA_PER_PAGE", "HOOK_PER_PAGE"},
			Name:    internal.FlagPerPage,
			Aliases: []string{"pp"},
			Usage:   "number of hooks to print per page",
			Value:   10,
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Get hooks for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  2. Get hooks for a repository with wide view output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output wide
  3. Get hooks for a repository with yaml output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output yaml
  4. Get hooks for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output json
  5. Get hooks for a repository when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/hook/get/
`, cli.CommandHelpTemplate),
}

CommandGet defines the command for capturing a list of hooks.

View Source
var CommandView = &cli.Command{
	Name:        "hook",
	Description: "Use this command to view a hook.",
	Usage:       "View details of the provided hook",
	Action:      view,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "HOOK_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the hook",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "HOOK_REPO"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the hook",
		},

		&cli.IntFlag{
			EnvVars: []string{"VELA_HOOK", "HOOK_NUMBER"},
			Name:    "hook",
			Aliases: []string{"number", "hn"},
			Usage:   "provide the number for the hook",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "HOOK_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
			Value:   "yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. View hook details for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --hook 1
  2. View hook details for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --hook 1 --output json
  3. View hook details for a repository when config or environment variables are set.
    $ {{.HelpName}} --hook 1

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/hook/view/
`, cli.CommandHelpTemplate),
}

CommandView defines the command for inspecting a hook.

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