fix 'kubectl cp' with no arguments causes a panic
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user