extkingpin

package module
v0.0.0-...-6b73929 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 16

Documentation

Overview

Taken from Thanos project.

Copyright (c) The Thanos Authors. Licensed under the Apache License 2.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagClause

type FlagClause interface {
	Flag(name, help string) *kingpin.FlagClause
}

type Option

type Option func(*PathOrContent)

Option is a functional option type for PathOrContent objects.

func WithEnvSubstitution

func WithEnvSubstitution() Option

WithEnvSubstitution allows you to override default envSubstitution option.

func WithHidden

func WithHidden() Option

WithHidden allows you to override the default option and keeps the flag hidden.

func WithRequired

func WithRequired() Option

WithRequired allows you to override default required option.

type PathOrContent

type PathOrContent struct {
	// contains filtered or unexported fields
}

PathOrContent is a flag type that defines two flags to fetch bytes. Either from file (*-file flag) or content (* flag).

func RegisterPathOrContent

func RegisterPathOrContent(cmd FlagClause, flagName string, help string, opts ...Option) *PathOrContent

RegisterPathOrContent registers PathOrContent flag in kingpinCmdClause.

func (*PathOrContent) Content

func (p *PathOrContent) Content() ([]byte, error)

Content returns the content of the file when given or directly the content that has been passed to the flag. It returns an error when: * The file and content flags are both not empty. * The file flag is not empty but the file can't be read. * The content is empty and the flag has been defined as required.

func (*PathOrContent) Path

func (p *PathOrContent) Path() string

Path returns the file's path.

Jump to

Keyboard shortcuts

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