mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
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 ```
This commit is contained in:
commit
0c698a4766
@ -164,6 +164,9 @@ func (o *CopyOptions) Validate(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *CopyOptions) Run(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])
|
srcSpec, err := extractFileSpec(args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user