Skip to content

Commit 2b1dd23

Browse files
authored
Merge pull request #274 from HappyTobi/recursive_copy
[NEW] add recursive copy
2 parents ef09091 + e95582c commit 2b1dd23

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cmd/limactl/copy.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,17 @@ func newCopyCommand() *cobra.Command {
3131
RunE: copyAction,
3232
}
3333

34+
copyCommand.Flags().BoolP("recursive", "r", false, "copy directories recursively")
35+
3436
return copyCommand
3537
}
3638

3739
func copyAction(cmd *cobra.Command, args []string) error {
40+
recursive, err := cmd.Flags().GetBool("recursive")
41+
if err != nil {
42+
return err
43+
}
44+
3845
arg0, err := exec.LookPath("scp")
3946
if err != nil {
4047
return err
@@ -43,7 +50,6 @@ func copyAction(cmd *cobra.Command, args []string) error {
4350
if err != nil {
4451
return err
4552
}
46-
4753
instDirs := make(map[string]string)
4854
scpArgs := []string{}
4955
debug, err := cmd.Flags().GetBool("debug")
@@ -53,6 +59,9 @@ func copyAction(cmd *cobra.Command, args []string) error {
5359
if debug {
5460
scpArgs = append(scpArgs, "-v")
5561
}
62+
if recursive {
63+
scpArgs = append(scpArgs, "-r")
64+
}
5665
scpArgs = append(scpArgs, "-3", "--")
5766
for _, arg := range args {
5867
path := strings.Split(arg, ":")

0 commit comments

Comments
 (0)