personaltoken

package
v0.0.0-...-b526a19 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(f *cmdutil.Factory) *cobra.Command

func ParseExpirationDate

func ParseExpirationDate(currentDate time.Time, expirationString string) (time.Time, error)

ParseExpirationDate parses a string representation of an expiration date and returns a time.Time value representing the expiration date. If the string is in interval format (e.g. "1d", "2w", "2m", "1y"), it calculates the expiration date from the current date and the specified interval. If the string is in full date format (e.g. "18/08/2023", "2023-02-12"), it tries to parse it as a full date and returns the parsed date if it is in the future. If the string doesn't match any of the supported formats, it returns an error.

Types

type Fields

type Fields struct {
	Name        string `json:"name,omitempty"`
	ExpiresAt   string `json:"expires_at,omitempty"`
	Description string `json:"description,omitempty"`
	Path        string
}

Jump to

Keyboard shortcuts

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