cmd

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSIONstring        = "0.0.4"
	Usage         string = `` /* 640-byte string literal not displayed */

	Examples string = `` /* 2796-byte string literal not displayed */

	ModeDiff int = iota
	ModeAdd

	DefaultFormat string = "Mon Jan 02 15:04:05 MST 2006"
)

Variables

This section is empty.

Functions

func Die

func Die(format string, err error) int

func Main

func Main(output io.Writer) int

Types

type Config

type Config struct {
	// TODO: add Timezone parameter
	Showversion bool   `koanf:"version"`
	Debug       bool   `koanf:"debug"`
	Diff        bool   `koanf:"diff"`
	Add         bool   `koanf:"add"`
	Examples    bool   `koanf:"examples"`
	Unit        bool   `koanf:"unit"`
	Format      string `koanf:"format"`
	Args        []string
	Output      io.Writer
	Mode        int
	// contains filtered or unexported fields
}

func InitConfig

func InitConfig(output io.Writer) (*Config, error)

type TPdatetime added in v0.0.2

type TPdatetime struct {
	TimestampProccessor
	Data time.Time
}

func (TPdatetime) String added in v0.0.2

func (datetime TPdatetime) String() string

type TPduration added in v0.0.2

type TPduration struct {
	TimestampProccessor
	Data time.Duration
}

func (TPduration) String added in v0.0.2

func (duration TPduration) String() string

type TimestampProccessor

type TimestampProccessor struct {
	Config
	Reference time.Time
}

func NewTP

func NewTP(conf *Config, ref ...time.Time) *TimestampProccessor

func (*TimestampProccessor) CalcDiff added in v0.0.3

func (tp *TimestampProccessor) CalcDiff(tsA time.Time, tsB time.Time)

func (*TimestampProccessor) CalcDuration added in v0.0.2

func (tp *TimestampProccessor) CalcDuration(tsA time.Time, durB time.Duration)

func (*TimestampProccessor) DualTimestamps added in v0.0.3

func (tp *TimestampProccessor) DualTimestamps(timestampA, timestampB string) error

func (*TimestampProccessor) Parse

func (tp *TimestampProccessor) Parse(timestamp string) (time.Time, error)

a post processor for ParseTimestamp() to apply custom time zone, if any

func (*TimestampProccessor) ParseTimestamp added in v0.0.3

func (tp *TimestampProccessor) ParseTimestamp(timestamp string) (time.Time, error)

Parse uses 3 different timestamp parser modules to provide maximum flexibility

func (*TimestampProccessor) Print

func (tp *TimestampProccessor) Print(ts TimestampWriter)

func (*TimestampProccessor) ProcessTimestamps

func (tp *TimestampProccessor) ProcessTimestamps() error

func (*TimestampProccessor) SingleTimestamp

func (tp *TimestampProccessor) SingleTimestamp(timestamp string) error

type TimestampWriter added in v0.0.2

type TimestampWriter interface {
	String() string
}

Jump to

Keyboard shortcuts

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