cmd

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// AnnotationRunAsRoot 标记需要以 root 用户运行的注解
	AnnotationRunAsRoot = "run-as-root"
	// AnnotationRequireManager 标记需要 manager.Manager 的注解
	AnnotationRequireManager = "require-manager"

	// AnnotationValueTrue 表示逻辑“真”的注解值
	AnnotationValueTrue = "true"
)

Variables

This section is empty.

Functions

func ChangeWorkingDirectory

func ChangeWorkingDirectory(cmd *cobra.Command, path string) error

ChangeWorkingDirectory 切换命令工作目录

func InjectManagerIfNecessary

func InjectManagerIfNecessary(cmd *cobra.Command, globalOptions options.GlobalOptionsGetter) error

InjectManagerIfNecessary 如果需要的话注入 manager.Manager

func ManagerFromContext

func ManagerFromContext(ctx context.Context) manager.Manager

ManagerFromContext 从上下文获取 manager.Manager

func NewContextWithManager

func NewContextWithManager(parent context.Context, mgr manager.Manager) context.Context

NewContextWithManager 将 mgr 注入到上下文中

func SetLogger

func SetLogger(cmd *cobra.Command, verbosity uint32) logr.Logger

SetLogger 设置命令日志,并返回 logr.Logger

func SwitchToRootIfNecessary

func SwitchToRootIfNecessary(cmd *cobra.Command) (bool, error)

SwitchToRootIfNecessary 如果需要的话切换到 root 用户运行

Types

This section is empty.

Jump to

Keyboard shortcuts

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