本文整理匯總了Golang中github.com/openshift/source-to-image/pkg/api.Config.Usage方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.Usage方法的具體用法?Golang Config.Usage怎麽用?Golang Config.Usage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/source-to-image/pkg/api.Config
的用法示例。
在下文中一共展示了Config.Usage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newCmdUsage
func newCmdUsage(cfg *api.Config) *cobra.Command {
oldScriptsFlag := ""
oldDestination := ""
usageCmd := &cobra.Command{
Use: "usage <image>",
Short: "Print usage of the assemble script associated with the image",
Long: "Create and start a container from the image and invoke its usage script.",
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
cmd.Help()
os.Exit(1)
}
cfg.Usage = true
cfg.BuilderImage = args[0]
if len(oldScriptsFlag) != 0 {
glog.Warning("DEPRECATED: Flag --scripts is deprecated, use --scripts-url instead")
cfg.ScriptsURL = oldScriptsFlag
}
if len(cfg.BuilderPullPolicy) == 0 {
cfg.BuilderPullPolicy = api.DefaultBuilderPullPolicy
}
if len(cfg.PreviousImagePullPolicy) == 0 {
cfg.PreviousImagePullPolicy = api.DefaultPreviousImagePullPolicy
}
uh, err := sti.NewUsage(cfg)
checkErr(err)
err = uh.Show()
checkErr(err)
},
}
usageCmd.Flags().StringVarP(&(oldDestination), "location", "l", "",
"Specify a destination location for untar operation")
cmdutil.AddCommonFlags(usageCmd, cfg)
return usageCmd
}