Example #1
0
func getInteractiveOptions() (set *goopt.OptionSet, interactive *bool) {
	set = goopt.NewOptionSet()

	interactive = set.
		DefineOption("interactive", "runs teasvc in interactive mode").
		ShortNames('i').
		Names("interactive").
		AsFlag(false)

	return
}
Example #2
0
package main

import (
	"errors"
	goopt "github.com/firelizzard18/goopt-fluent"
	"io"
	"log"
	"os"
	"strings"
)

var cliops = goopt.NewOptionSet()

var list = cliops.
	DefineOption("list-servers", "list the available servers").
	ShortNames('l').
	Names("ls", "list", "list-servers").
	AsFlag(false)

var timeout = cliops.
	DefineOption("list-timeout", "timeout for listing available servers").
	ShortNames('t').
	Names("timeout").
	AsInt(100)

var connect = cliops.
	DefineOption("connect", "connect to a server's output").
	Names("connect").
	AsString("")

var command = cliops.
Example #3
0
package main

import (
	"errors"
	"fmt"
	goopt "github.com/firelizzard18/goopt-fluent"
	"os"
)

var genops = goopt.NewOptionSet()

var bus = genops.
	DefineOption("dbus", "set the DBus bus").
	ShortNames('b').
	Names("bus", "dbus-bus").
	AsString("session")

func init() {
	initServerModeOptions()
}

func main() {
	os.Exit(mainMain())
}

func mainMain() int {
	var cmd TeaCmd
	if len(os.Args) < 2 || os.Args[1][0] == '-' {
		cmd = Command_None
	} else {
		cmd = getCommand(os.Args[1])
Example #4
0
package main

import (
	"errors"
	goopt "github.com/firelizzard18/goopt-fluent"
	"log"
	"os"
	"strings"
)

var devNull *os.File

var serops = goopt.NewOptionSet()

var asDaemon = serops.
	DefineOption("daemon", "run in the foreground").
	ShortNames('F').
	Names("foreground").
	DefineAlternate("run as a daemon in the background").
	ShortNames('D').
	Names("daemon", "background").
	AsFlag(false)

var description = serops.
	DefineOption("description", "service description as presented to clients").
	ShortNames('d').
	Names("desc", "description").
	AsString("")

var inSrc, outDest, errDest *os.File