cfg

package
v4.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package cfg contains common configuration variables.

Index

Constants

View Source
const (
	CPUProfile = ""
	MEMProfile = ""
)

Variables

View Source
var (
	TraceFile      string
	LogFile        string
	UseJSONHandler bool
	Verbose        bool

	Output     string
	ConfigFile string
	Workspace  string

	Limits = network.DefLimits

	ForceEnterprise bool
	MachineIDOvr    string // Machine ID override
	NoEncryption    bool   // disable encryption

	MemberOnly          bool
	OnlyChannelUsers    bool
	IncludeCustomLabels bool // Requests labels for user custom fields, use with caution due to request throttling.
	// ChannelTypes lists channel types to fetch.
	ChannelTypes = slackChanTypes(slackdump.AllChanTypes)
	// FailOnNonCritical enables hard fail on non-critical errors, such as
	// "channel not found", or "user not in channel". By default it is
	// disabled.
	FailOnNonCritical bool

	WithFiles   bool
	WithAvatars bool
	RecordFiles bool // record file chunks in chunk files.

	// Oldest is the default timestamp of the oldest message to fetch, that is
	// used by the dump and export commands.
	Oldest = TimeValue(time.Time{})
	// Latest is the default timestamp of the newest message to fetch, that is
	// used by the dump and export commands.  It is set to an exact value
	// for the dump to be consistent.
	Latest = TimeValue(time.Now())

	LocalCacheDir      string
	UserCacheRetention time.Duration
	NoUserCache        bool
	NoChunkCache       bool
	UseChunkFiles      bool // Use chunk files for storage, instead of sqlite database.

	Log *slog.Logger = slog.Default()
	// LoadSecrets is a flag that indicates whether to load secrets from the
	// environment variables.
	LoadSecrets bool

	YesMan bool // if true, all questions are answered with "yes"

	Version BuildInfo // version propagated by main package.
)
View Source
var (
	// ErrVerUnknown indicates that this is either a development build or
	// version is not set.
	ErrVerUnknown = errors.New("version unknown")
	// ErrDateUknown indicates that the date is either not set or unknown.
	ErrDateUnknown = errors.New("unknown date")
)

Functions

func CacheDir

func CacheDir() string

func SetBaseFlags

func SetBaseFlags(fs *flag.FlagSet, mask FlagMask)

SetBaseFlags sets base flags

func SetDebugLevel

func SetDebugLevel()

func StripZipExt

func StripZipExt(s string) string

StripZipExt removes the .zip extension from the string.

Types

type BuildInfo

type BuildInfo struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
}

func (BuildInfo) IsReleased added in v4.1.0

func (b BuildInfo) IsReleased() bool

func (BuildInfo) Normalised added in v4.1.1

func (b BuildInfo) Normalised() (BuildInfo, error)

Normalised returns the normalised BuildInfo: - version has v prefix - Build is in 2006-01-02 15:04:05Z format. - commit is unchanged, so may be "Homebrew" It will return ErrVerUknown if version is unknown (i.e. unreleased).

func (BuildInfo) String

func (b BuildInfo) String() string

type FlagMask

type FlagMask uint32
const (
	DefaultFlags  FlagMask = 0
	OmitAuthFlags FlagMask = 1 << iota
	OmitWithFilesFlag
	OmitConfigFlag
	OmitOutputFlag
	OmitCacheDir
	OmitWorkspaceFlag
	OmitUserCacheFlag
	OmitTimeframeFlag
	OmitChunkCacheFlag
	OmitCustomUserFlags
	OmitRecordFilesFlag
	OmitWithAvatarsFlag
	OmitChunkFileMode
	OmitYesManFlag
	OmitChannelTypesFlag
	OmitMemberOnlyFlag

	OmitAll = OmitConfigFlag |
		OmitWithFilesFlag |
		OmitOutputFlag |
		OmitCacheDir |
		OmitWorkspaceFlag |
		OmitAuthFlags |
		OmitUserCacheFlag |
		OmitTimeframeFlag |
		OmitChunkCacheFlag |
		OmitCustomUserFlags |
		OmitRecordFilesFlag |
		OmitWithAvatarsFlag |
		OmitChunkFileMode |
		OmitYesManFlag |
		OmitMemberOnlyFlag |
		OmitChannelTypesFlag
)

type StringSlice

type StringSlice []string

StringSlice provides a flag.Value interface for a slice of strings.

func (*StringSlice) Set

func (ss *StringSlice) Set(s string) error

func (*StringSlice) String

func (ss *StringSlice) String() string

type TimeValue

type TimeValue time.Time

TimeValue satisfies flag.Value, used for command line parsing.

func (*TimeValue) Set

func (tv *TimeValue) Set(s string) error

func (TimeValue) String

func (tv TimeValue) String() string

Jump to

Keyboard shortcuts

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