mirror of https://github.com/k3s-io/k3s
Merge pull request #65482 from wgliang/master.handle-args
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix 'kubectl cp' with no arguments causes a panic **What this PR does / why we need it**: /kind bug "kubectl cp" with no arguments causes a panic **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #65475 **Special notes for your reviewer**: **Release note**: ```release-note Fix 'kubectl cp' with no arguments causes a panic ```pull/8/head
commit
0c698a4766
|
@ -164,6 +164,9 @@ func (o *CopyOptions) Validate(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
func (o *CopyOptions) Run(args []string) error {
|
||||
if len(args) < 2 {
|
||||
return fmt.Errorf("source and destination are required")
|
||||
}
|
||||
srcSpec, err := extractFileSpec(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue