Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.86 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.86 KB

ymdflag

Units tests Coverage Status golangci-lint CodeQL Go ReportCard Go Reference

YMDFlag implements a Golang flag.Value interface for YYYYMMDD-specified dates. This facilitiates command-line argument handling of date parameters such -start-date=20210101.

Documentation

go get github.com/neomantra/ymdflag

https://pkg.go.dev/github.com/neomantra/ymdflag

Examples

There are examples in the examples/ directory. Here's a quick sketch:

package main

import (
	"github.com/neomantra/ymdflag"
	"github.com/spf13/pflag"
)

func main() {
	var ymd ymdflag.YMDFlag
	pflag.VarP(&ymd, "date", "d", "YYYYMMDD date; defaults to today in local time")
	pflag.Parse()
	println("time of date:", ymd.AsTime().String())
}

Credits and License

Copyright (c) 2022-2023 Neomantra BV. Authored by Evan Wies.

Released under the MIT License, see LICENSE.txt.