Help us shape the future of Go! Take the 2026 Go Developer Survey

flagrc

package module
v0.0.0-...-748e142 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2015 License: Apache-2.0 Imports: 3 Imported by: 1

README

Flagrc

Flagrc reads arguments from a file, similiar to .ackrc.

Usage

Examplerc file

-username=myusername
-date=2014-01-12

Go code

package main

import (
	"flag"
	"github.com/fabiofalci/flagrc"
)

func main() {
	flagrc.ProcessFlagrc("examplerc")

	providedUsername := flag.String("username", "", "App username")
	providedDate := flag.String("date", "", "App date")

	flag.Parse()

	println("Username: " + *providedUsername)
	println("Date: " + *providedDate)
}

Output

$ go run example2.go
Username: myusername
Date: 2014-01-12

$ go run example2.go -date=1970-01-01
Username: myusername
Date: 1970-01-01

$ go run example2.go -username=other
Username: other
Date: 2014-01-12

$ go run example2.go -date=1970-01-01 -username=other
Username: other
Date: 1970-01-01

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessFlagrc

func ProcessFlagrc(filePath string)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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