Exemplo n.º 1
0
func main() {
	flag.Parse()

	cli.RequireArgs(2, "You must provide 2 distinct numbers as arguments to the program")
	args := cli.IntsArgs()

	fmt.Println("Greatest common divisor is", Gcd(args[0], args[1]))
}
Exemplo n.º 2
0
func main() {
	alg := cli.AlgorithmFlag(availableAlgs, "eratosphen_sieve")
	args := cli.IntsArgs()

	f := availableAlgs[alg]

	fmt.Println("Algorithm:", alg)
	f(args)
}
Exemplo n.º 3
0
func main() {
    alg := cli.AlgorithmFlag(availableAlgs, "merge")
    cli.RequireSortingArgs()

    list := cli.IntsArgs()

    f := availableAlgs[alg]

    f(list)

    fmt.Println("Algorithm:", alg)
    fmt.Println("Sorted list:", list)
}