本文整理汇总了Golang中github.com/codegangsta/cli.App.CommandNotFound方法的典型用法代码示例。如果您正苦于以下问题:Golang App.CommandNotFound方法的具体用法?Golang App.CommandNotFound怎么用?Golang App.CommandNotFound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/codegangsta/cli.App
的用法示例。
在下文中一共展示了App.CommandNotFound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
flagSet := flag.NewFlagSet("flag_set", flag.ContinueOnError)
flagSet.Parse([]string{"one_arg"})
testContext := cli.NewContext(cliApp, flagSet, nil)
cliApp.Action(testContext)
Expect(outputBuffer).To(test_helpers.Say("ltc: 'one_arg' is not a registered command. See 'ltc help'"))
})
})
})
Describe("App.CommandNotFound", func() {
It("prints unknown command message and exits nonzero", func() {
testContext := cli.NewContext(cliApp, &flag.FlagSet{}, nil)
cliApp.CommandNotFound(testContext, "do_it")
Expect(outputBuffer).To(test_helpers.Say("ltc: 'do_it' is not a registered command. See 'ltc help'"))
Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{1}))
})
})
Describe("App.Before", func() {
Context("when running the target command", func() {
It("does not verify the current target", func() {
cliConfig.SetTarget("my-lattice.example.com")
Expect(cliConfig.Save()).To(Succeed())
commandRan := false
cliApp.Commands = []cli.Command{