fix 'kubectl cp' with no arguments causes a panic

pull/8/head
Guoliang Wang 2018-06-26 22:22:24 +08:00
parent 28b7809d2f
commit 254b02bcc6
1 changed files with 3 additions and 0 deletions

View File

@ -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