gflag

module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MIT

README

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)
}

Directories

Path Synopsis
_example

Jump to

Keyboard shortcuts

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