Skip to content

Commit

Permalink
Add a flag to use rsync instead of scp
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed Jan 19, 2024
1 parent 5d15006 commit 62b2ec1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/limactl/guest_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func newGuestInstallCommand() *cobra.Command {
ValidArgsFunction: cobra.NoFileCompletions,
Hidden: true,
}
guestInstallCommand.Flags().BoolP("rsync", "", false, "use rsync")
return guestInstallCommand
}

Expand All @@ -35,7 +36,12 @@ func runCmd(name string, flags []string, args ...string) error {
return cmd.Run()
}

func guestInstallAction(_ *cobra.Command, args []string) error {
func guestInstallAction(cmd *cobra.Command, args []string) error {
rsync, err := cmd.Flags().GetBool("rsync")
if err != nil {
return err
}

instName := DefaultInstanceName
if len(args) > 0 {
instName = args[0]
Expand All @@ -55,6 +61,10 @@ func guestInstallAction(_ *cobra.Command, args []string) error {

scpExe := "scp"
scpFlags := sshFlags
if rsync {
scpExe = "rsync"
scpFlags = []string{"-e", "ssh -F " + sshConfig, "--progress"}
}

y, err := inst.LoadYAML()
if err != nil {
Expand Down

0 comments on commit 62b2ec1

Please sign in to comment.