flagstone is a Go library to convert flags to web UI.
go get github.com/kurehajime/flagstone
-
Use golang's standard flag package.
package main import ( "flag" "fmt" ) var who *string func main() { who = flag.String("who", "world", "say hello to ...") flag.Parse() fmt.Println("hello " + *who + "!") }
-
Import flagstone and add one line.
package main import ( "flag" "github.com/kurehajime/flagstone" //★ here ★ "fmt" ) var who *string func main() { who = flag.String("who", "world", "say hello to ...") flag.Parse() flagstone.Launch("helloworld", "flagstone sample") //★ here ★ fmt.Println("hello " + *who + "!") }
-
Finish!
When you run the program, the browser starts.
Pressing the "Run" button sets the flag and runs the program.
Specify the port number.
Specify sub URL. If not specified, it is determined randomly.
Specify the order of the parameters. If not specified, it will be in ABC order.
If set to true, flagstone will not produce any extra output.
If true is set, non-flag arguments are added. non-flag arguments can be obtained by the return value of the Lanch method.
Specify CSS.