Ejemplo n.º 1
0
func main() {
	flag.MakeHelpFlag()
	flag.SetHelpTitles("flagtest - Test the mauflag package", "mauflag [-b] [-x] [-y] [-z] [-s STRING] [-a ARRAY VALUE] [--asd STRING]")
	fmt.Println(flag.Parse())

	if flag.CheckHelpFlag() {
		return
	}

	fmt.Println(*bf, *xb, *yb, *zb)
	fmt.Println(*str)
	fmt.Println(*def)
	for _, arg := range *array {
		fmt.Print(arg, ", ")
	}
	fmt.Print("\n")
	for _, arg := range flag.Args() {
		fmt.Print(arg, ", ")
	}
	fmt.Print("\n")
}
Ejemplo n.º 2
0
	"fmt"
	"os"
	"os/signal"
	"strings"
	"syscall"

	msg "github.com/sorcix/irc"
	"github.com/sorcix/irc/ctcp"
	irc "maunium.net/go/libmauirc"
	flag "maunium.net/go/mauflag"
)

var ip = flag.Make().ShortKey("a").LongKey("address").Usage("The address to connect to.").String()
var port = flag.Make().ShortKey("p").LongKey("port").Usage("The port to connect to.").Uint16()
var tls = flag.Make().ShortKey("s").LongKey("ssl").LongKey("tls").Usage("Whether or not to enable TLS.").Bool()
var wantHelp, _ = flag.MakeHelpFlag()

func main() {
	err := flag.Parse()
	flag.SetHelpTitles("lmitest - A simple program to test libmauirc.", "lmitest [-h] [-s] [-a IP ADDRESS] [-p PORT]")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		flag.PrintHelp()
		os.Exit(1)
	} else if *wantHelp {
		flag.PrintHelp()
		os.Exit(0)
	}

	c := irc.Create("lmitest", "lmitest", irc.IPv4Address{IP: *ip, Port: *port})
	c.SetRealName("libmauirc tester")