state

package
v0.0.331 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package state implements setters and getters for command contexts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDirectory

func ConfigDirectory(ctx context.Context) string

ConfigDirectory returns the config directory ctx carries. It panics in case ctx carries no config directory.

func ConfigFile

func ConfigFile(ctx context.Context) string

ConfigFile returns the config file ctx carries. It panics in case ctx carries no config directory.

func Hostname

func Hostname(ctx context.Context) string

Hostname returns the hostname ctx carries. It panics in case ctx carries no hostname.

func UserHomeDirectory

func UserHomeDirectory(ctx context.Context) string

UserHomeDirectory returns the user home directory ctx carries. It panics in case ctx carries no user home directory.

func WithConfigDirectory

func WithConfigDirectory(ctx context.Context, cd string) context.Context

WithConfigDir derives a Context that carries the given config directory from ctx.

func WithHostname

func WithHostname(ctx context.Context, hostname string) context.Context

WithHostname returns a copy of ctx that carries hostname.

func WithUserHomeDirectory

func WithUserHomeDirectory(ctx context.Context, uhd string) context.Context

WithUserHomeDirectory derives a Context that carries the given user home directory from ctx.

func WithWorkingDirectory

func WithWorkingDirectory(ctx context.Context, wd string) context.Context

WithWorkingDirectory derives a Context that carries the given working directory from ctx.

func WorkingDirectory

func WorkingDirectory(ctx context.Context) string

WorkingDirectory returns the working directory ctx carries. It panics in case ctx carries no working directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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