https://github.com/kurehajime/flagstone
flagstone is a Go library to convert flags to web UI.
https://github.com/kurehajime/flagstone
cross-platform cui go golang golang-library golang-package gui web
Last synced: 2 months ago
JSON representation
flagstone is a Go library to convert flags to web UI.
- Host: GitHub
- URL: https://github.com/kurehajime/flagstone
- Owner: kurehajime
- License: mit
- Created: 2020-02-11T02:09:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-13T10:13:10.000Z (over 4 years ago)
- Last Synced: 2025-04-23T19:36:29.728Z (6 months ago)
- Topics: cross-platform, cui, go, golang, golang-library, golang-package, gui, web
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 22
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flagstone
flagstone is a Go library to convert flags to web UI.

## install
```
go get github.com/kurehajime/flagstone
```## usage
1. Use golang's standard flag package.
```
package mainimport (
"flag"
"fmt"
)var who *string
func main() {
who = flag.String("who", "world", "say hello to ...")
flag.Parse()fmt.Println("hello " + *who + "!")
}
```1. Import flagstone and add one line.
```
package mainimport (
"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 + "!")
}```
1. Finish!
When you run the program, the browser starts.
Pressing the "Run" button sets the flag and runs the program.

## options
#### SetPort
Specify the port number.
#### SetSubURL
Specify sub URL.
If not specified, it is determined randomly.#### SetSort
Specify the order of the parameters.
If not specified, it will be in ABC order.#### SetSilent
If set to true, flagstone will not produce any extra output.
#### SetUseNonFlagArgs
If true is set, non-flag arguments are added.
non-flag arguments can be obtained by the return value of the Lanch method.#### SetCSS
Specify CSS.