cliutil

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlagVeryVerbose = &cli.BoolFlag{
	Name:        "vv",
	Usage:       "enables very verbose mode, useful for debugging the CLI",
	Destination: &IsVeryVerbose,
}

FlagVeryVerbose enables very verbose mode, which is useful when debugging the CLI itself. It should be included as a flag on the top-level command

View Source
var IsVeryVerbose bool

IsVeryVerbose is a global var signalling if the CLI is running in very verbose mode or not (default: false).

Functions

func DaemonContext

func DaemonContext(cctx *cli.Context) context.Context

func GetCandidateAPI

func GetCandidateAPI(ctx *cli.Context) (api.Candidate, jsonrpc.ClientCloser, error)

func GetCommonAPI

func GetCommonAPI(ctx *cli.Context) (api.Common, jsonrpc.ClientCloser, error)

func GetEdgeAPI

func GetEdgeAPI(ctx *cli.Context) (api.Edge, jsonrpc.ClientCloser, error)

func GetLocatorAPI

func GetLocatorAPI(ctx *cli.Context) (api.Locator, jsonrpc.ClientCloser, error)

func GetRawAPI

func GetRawAPI(ctx *cli.Context, t repo.RepoType, version string) (string, http.Header, error)

func GetSchedulerAPI

func GetSchedulerAPI(ctx *cli.Context, nodeID string) (api.Scheduler, jsonrpc.ClientCloser, error)

func ReqContext

func ReqContext(cctx *cli.Context) context.Context

ReqContext returns context for cli execution. Calling it for the first time installs SIGTERM handler that will close returned context. Not safe for concurrent execution.

Types

type APIInfo

type APIInfo struct {
	Addr  string
	Token []byte
}

func GetAPIInfo

func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error)

GetAPIInfo returns the API endpoint to use for the specified kind of repo.

The order of precedence is as follows:

  1. *-api-url command line flags.
  2. *_API_INFO environment variables
  3. deprecated *_API_INFO environment variables
  4. *-repo command line flags.

func ParseAPIInfo

func ParseAPIInfo(s string) APIInfo

func (APIInfo) AuthHeader

func (a APIInfo) AuthHeader() http.Header

func (APIInfo) DialArgs

func (a APIInfo) DialArgs(version string) (string, error)

func (APIInfo) Host

func (a APIInfo) Host() (string, error)

Jump to

Keyboard shortcuts

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