Skip to content

A go1.18 wrapper to provide a simple generics based API for defining command line flags.

License

Notifications You must be signed in to change notification settings

ckaznocha/gflag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gflag

A go1.18 wrapper to provide simple generics based API for defining command line flags.

Example

package main

import (
	"flag"
	"fmt"
	"time"

	"github.com/ckaznocha/gflag"
)

func main() {
	salutation := gflag.Define("salutation", "Hello", "a salutation")
	subject := gflag.Define("subject", "user", "a subject to greet")
	wait := gflag.Define("wait", 1*time.Second, "how long  to  wait before greeting")
	flag.Parse()

	time.Sleep(*wait)

	fmt.Printf("%s, %s\n", *salutation, *subject)
}

About

A go1.18 wrapper to provide a simple generics based API for defining command line flags.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages