// NewCmdLink implements the link odo command
NewCmdLink implements the link odo command
// NewCmdLink implements the link odo command
func NewCmdLink(name, fullName string) *cobra.Command {
	o := NewLinkOptions()
	linkCmd := &cobra.Command{
		Use:         fmt.Sprintf("%s <operator-service-type>/<service-name> OR %s <service> --component [component] OR %s <component> --component [component]", name, name, name),
		Short:       "Link component to a service or component",
		Long:        linkLongDesc,
		Example:     fmt.Sprintf(linkExample, fullName),
		Args:        cobra.ExactArgs(1),
		Annotations: map[string]string{"command": "component"},
		Run: func(cmd *cobra.Command, args []string) {
			genericclioptions.GenericRun(o, cmd, args)
		},
	}
	linkCmd.PersistentFlags().StringVar(&o.port, "port", "", "Port of the backend to which to link")
	linkCmd.PersistentFlags().BoolVarP(&o.wait, "wait", "w", false, "If enabled the link will return only when the component is fully running after the link is created")
	linkCmd.PersistentFlags().BoolVar(&o.waitForTarget, "wait-for-target", false, "If enabled, the link command will wait for the service to be provisioned (has no effect when linking to a component)")
	linkCmd.PersistentFlags().StringVar(&o.name, "name", "", "Name of the created ServiceBinding resource")
	linkCmd.PersistentFlags().BoolVar(&o.bindAsFiles, "bind-as-files", false, "If enabled, configuration values will be mounted as files, instead of declared as environment variables")
	linkCmd.SetUsageTemplate(odoutil.CmdUsageTemplate)
	projectCmd.AddProjectFlag(linkCmd)
	appCmd.AddApplicationFlag(linkCmd)
	AddComponentFlag(linkCmd)
	genericclioptions.AddContextFlag(linkCmd, &o.componentContext)
	completion.RegisterCommandHandler(linkCmd, completion.LinkCompletionHandler)
	return linkCmd
}
func NewCmdLink ( name , fullName string ) * cobra . Command { o := NewLinkOptions ( ) linkCmd := & cobra . Command { Use : fmt . Sprintf ( " " , name , name , name ) , Short : " " , Long : linkLongDesc , Example : fmt . Sprintf ( linkExample , fullName ) , Args : cobra . ExactArgs ( 1 ) , Annotations : map [ string ] string { " " : " " } , Run : func ( cmd * cobra . Command , args [ ] string ) { genericclioptions . GenericRun ( o , cmd , args ) } , } linkCmd . PersistentFlags ( ) . StringVar ( & o . port , " " , " " , " " ) linkCmd . PersistentFlags ( ) . BoolVarP ( & o . wait , " " , " " , false , " " ) linkCmd . PersistentFlags ( ) . BoolVar ( & o . waitForTarget , " " , false , " " ) linkCmd . PersistentFlags ( ) . StringVar ( & o . name , " " , " " , " " ) linkCmd . PersistentFlags ( ) . BoolVar ( & o . bindAsFiles , " " , false , " " ) linkCmd . SetUsageTemplate ( odoutil . CmdUsageTemplate ) projectCmd . AddProjectFlag ( linkCmd ) appCmd . AddApplicationFlag ( linkCmd ) AddComponentFlag ( linkCmd ) genericclioptions . AddContextFlag ( linkCmd , & o . componentContext ) completion . RegisterCommandHandler ( linkCmd , completion . LinkCompletionHandler ) return linkCmd }
NewCmdLink implements the link odo command
NewCmdLink implements the link odo command
//Adding `--project` flag //Adding `--application` flag //Adding `--component` flag //Adding context flag