util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package util provides shared utilities for the CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CELExpressionReferencesFields added in v0.4.0

func CELExpressionReferencesFields(celCmd string, fieldNames []string, options ...cel.EnvOption) (bool, error)

CELExpressionReferencesFields checks if a CEL expression references any of the given field names. Returns true if the expression references at least one of the specified fields.

func GetClient

func GetClient(ctx context.Context) (*api.Client, error)

GetClient gets a Logged in Passbolt Client

func GetClientCertificate added in v0.3.2

func GetClientCertificate() (tls.Certificate, error)

func GetContext

func GetContext() (context.Context, context.CancelFunc)

func GetHTTPClient added in v0.4.2

func GetHTTPClient() (*http.Client, error)

func InitCELProgram added in v0.3.0

func InitCELProgram(celCmd string, options ...cel.EnvOption) (*cel.Program, error)

InitCELProgram - Initialize a CEL program with given CEL command and a set of environments

func ReadPassword added in v0.2.0

func ReadPassword(prompt string) (string, error)

ReadPassword reads a Password interactively or via Pipe

func SaveSessionKeysAndLogout added in v0.4.0

func SaveSessionKeysAndLogout(ctx context.Context, client *api.Client)

SaveSessionKeysAndLogout saves any pending session keys to the server and then logs out. This should be used instead of client.Logout() to ensure session keys are persisted.

Types

type ColumnAlias added in v0.5.0

type ColumnAlias struct {
	Name    string
	Aliases []string
}

ColumnAlias declares a canonical column name together with the legacy input forms that should resolve to it. Used by list commands to accept snake_case (canonical), PascalCase, and lowercased-concat forms uniformly in --column and --filter flags.

type ColumnAliasResolver added in v0.5.0

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

ColumnAliasResolver normalizes user-supplied column names to their canonical form via case-insensitive lookup against name+aliases.

func NewColumnAliasResolver added in v0.5.0

func NewColumnAliasResolver(specs []ColumnAlias) *ColumnAliasResolver

func (*ColumnAliasResolver) Canonical added in v0.5.0

func (r *ColumnAliasResolver) Canonical() []string

Canonical returns the canonical column names in declaration order. Useful for building --column flag help text and default value slices.

func (*ColumnAliasResolver) Normalize added in v0.5.0

func (r *ColumnAliasResolver) Normalize(input string) (string, error)

Normalize maps an input column name to its canonical form. Returns an error listing the valid canonical names if the input matches nothing.

func (*ColumnAliasResolver) NormalizeAll added in v0.5.0

func (r *ColumnAliasResolver) NormalizeAll(inputs []string) ([]string, error)

NormalizeAll normalizes a slice of input column names, returning the canonical-name slice or the first error encountered.

type PermissionJSONOutput added in v0.4.2

type PermissionJSONOutput struct {
	ID                *string    `json:"id,omitempty"`
	Aco               *string    `json:"aco,omitempty"`
	AcoForeignKey     *string    `json:"aco_foreign_key,omitempty"`
	Aro               *string    `json:"aro,omitempty"`
	AroForeignKey     *string    `json:"aro_foreign_key,omitempty"`
	Type              *int       `json:"type,omitempty"`
	CreatedTimestamp  *time.Time `json:"created_timestamp,omitempty"`
	ModifiedTimestamp *time.Time `json:"modified_timestamp,omitempty"`
}

Jump to

Keyboard shortcuts

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