Skip to content

Commit

Permalink
function
Browse files Browse the repository at this point in the history
  • Loading branch information
therealpaulgg committed Oct 30, 2024
1 parent 9c95a16 commit 7b86de2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/actions/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ func Download(c *cli.Context) error {
return err
}
}

err = checkForDeletedKeys(data.Keys, directory)

if err != nil {
return err
}
fmt.Println("Successfully downloaded keys.")
return nil
}

func checkForDeletedKeys(keys []dto.KeyDto, directory string) error {
sshDir, err := utils.GetAndCreateSshDirectory(directory)
if err != nil {
return err
Expand All @@ -67,7 +78,7 @@ func Download(c *cli.Context) error {
if d.Name() == "config" {
return nil
}
_, exists := lo.Find(data.Keys, func(key dto.KeyDto) bool {
_, exists := lo.Find(keys, func(key dto.KeyDto) bool {
return key.Filename == d.Name()
})
if exists {
Expand All @@ -89,7 +100,5 @@ func Download(c *cli.Context) error {
if err != nil {
return err
}

fmt.Println("Successfully downloaded keys.")
return nil
}

0 comments on commit 7b86de2

Please sign in to comment.