Esempio n. 1
0
// Handler accepts a climax.Context object and returns an exitcode integer.
func Example_handler(ctx climax.Context) int {
	if len(ctx.Args) < 2 {
		ctx.Log("not enough arguments")

		// with os.Exit(1)
		return 1
	}

	if name, ok := ctx.Get("name"); ok {
		// argument `name` parsed
		fmt.Println(name)

	} else {
		ctx.Log("name not specified")

		return 1
	}

	return 0
}