mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Set AttachOptions.CommandName from kubectl run using corba CommandPath
This sets AttachOptions.CommandName dynamically depending on the corba Command hierarchy. If the root command is named e.g. "oc" (for the OpenShift cli) this will result in "oc attach" instead of the static "kubectl attach" before this patch. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1341450
This commit is contained in:
@@ -53,8 +53,6 @@ func NewCmdAttach(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer)
|
||||
Out: cmdOut,
|
||||
Err: cmdErr,
|
||||
|
||||
CommandName: "kubectl attach",
|
||||
|
||||
Attach: &DefaultRemoteAttach{},
|
||||
}
|
||||
cmd := &cobra.Command{
|
||||
@@ -142,6 +140,10 @@ func (p *AttachOptions) Complete(f *cmdutil.Factory, cmd *cobra.Command, argsIn
|
||||
}
|
||||
p.Client = client
|
||||
|
||||
if p.CommandName == "" {
|
||||
p.CommandName = cmd.CommandPath()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user