Beispiel #1
0
func Test_ShowAppHelp_NoAuthor(t *testing.T) {
	output := new(bytes.Buffer)
	app := cli.NewApp()
	app.Writer = output

	c := cli.NewContext(app, nil, nil)

	cli.ShowAppHelp(c)

	if bytes.Index(output.Bytes(), []byte("AUTHOR(S):")) != -1 {
		t.Errorf("expected\n%snot to include %s", output.String(), "AUTHOR(S):")
	}
}
Beispiel #2
0
func doBefore(c *cli.Context) error {

	args := c.Args()

	if len(args) == 0 {
		cli.ShowAppHelp(c)
		os.Exit(1)
	}
	for _, arg := range args {
		ok, _ := regexp.MatchString(`\.ya?ml$`, arg)
		if !ok {
			fmt.Println(arg + " is not yaml file.")
			os.Exit(2)
		}
	}

	return nil
}