Skip to content

Commit

Permalink
added some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdiooa committed Jun 7, 2024
1 parent 7ea1dfb commit 41aa04c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/zeroward/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package zeroward

import (
"fmt"
"strings"

"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/downloading"
Expand All @@ -11,17 +12,17 @@ import (
var downloadCmd = &cobra.Command{
Use: "download",
Short: "Download Command to download Files from the cloud.",
Long: `This command is used to download User Objects(Files) from the cloud storage, also gives you an readable files if the files were encrypted.`,
Long: `This Command is used to download User Objects(Files) from user cloud storage.`,
Run: func(cmd *cobra.Command, args []string) {
accessKeyID, _ := cmd.Flags().GetString("accessKeyID")
secretAccessKey, _ := cmd.Flags().GetString("secretAccessKey")
bcktName, _ := cmd.Flags().GetString("bucketName")
filePath, _ := cmd.Flags().GetString("filePath")
objectkey, _ := cmd.Flags().GetString("objectkey")
removeAfterDownload, _ := cmd.Flags().GetBool("remove")
decryptWhileDownloading, _ := cmd.Flags().GetBool("decrypt")
// decryptWhileDownloading, _ := cmd.Flags().GetBool("decrypt")

if decryptWhileDownloading {
if strings.HasSuffix(objectkey, ".enc") {
if err := handleDownload(accessKeyID, secretAccessKey, bcktName, filePath, objectkey, removeAfterDownload); err != nil {
fmt.Println("Error:", err)
return
Expand Down Expand Up @@ -52,5 +53,5 @@ func handleDownload(accessKeyID, secretAccessKey, bcktName, filePath, objectkey
func init() {
rootCmd.AddCommand(downloadCmd)
downloadCmd.Flags().BoolP("remove", "r", false, "Remove the file from the cloud storage after successful download")
downloadCmd.Flags().BoolP("decrypt", "d", false, "Decrypt file while downloading")
// downloadCmd.Flags().BoolP("decrypt", "d", false, "Decrypt file while downloading")
}

0 comments on commit 41aa04c

Please sign in to comment.