flagstone

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 15 Imported by: 0

README

flagstone

flagstone is a Go library to convert flags to web UI.

flagstone

install

go get github.com/kurehajime

usage

  1. 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 + "!")
    }
    
  2. Import flagstone and add one line.

    package main
    
    import (
        "flag"
        "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 + "!")
    }
    
    
  3. Finish!

    When you run the program, the browser starts.

    Pressing the "Run" button sets the flag and runs the program.

    screenshot

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Launch

func Launch(title string, message string) ([]string, bool)

Launch : Capture the flag

func SetCSS

func SetCSS(s string)

SetCSS : Specify CSS

func SetPort

func SetPort(n int)

SetPort : Set port number

func SetSilent

func SetSilent(b bool)

SetSilent : mute log

func SetSort

func SetSort(sa []string)

SetSort : Sort By Index

func SetSubURL

func SetSubURL(s string)

SetSubURL : Set Window Name

func SetUseNonFlagArgs

func SetUseNonFlagArgs(b bool)

SetUseNonFlagArgs : make non-flag arguments

Types

This section is empty.

Jump to

Keyboard shortcuts

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