Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CompressCmd = &cobra.Command{ Use: "compress", Short: "Compress files", Long: "Compress files using Gzip compression.", Run: func(cmd *cobra.Command, args []string) { inputPaths, _ := cmd.Flags().GetStringSlice("input") outputPaths, _ := cmd.Flags().GetStringSlice("output") progress := progressbar.NewOptions(len(inputPaths), progressbar.OptionSetDescription("[cyan][Compressing files...][reset]"), progressbar.OptionSetWriter(os.Stderr), progressbar.OptionShowCount(), progressbar.OptionShowBytes(true), progressbar.OptionEnableColorCodes(true), ) for i := 0; i < len(inputPaths); i++ { err := CompressFile(inputPaths[i], outputPaths[i]+".gz") if err != nil { color.Red("Error compressing: %v", err) } else { progress.Add(1) color.Green("\nCompression successful for %s", inputPaths[i]) } } progress.Finish() }, }
View Source
var DecryptCmd = &cobra.Command{ Use: "decrypt", Short: "Decrypt files", Long: "Decrypt files using AES-GCM decryption.", Run: func(cmd *cobra.Command, args []string) { inputPaths, _ := cmd.Flags().GetStringSlice("input") outputPaths, _ := cmd.Flags().GetStringSlice("output") key := internal.GetKey() progress := progressbar.NewOptions(len(inputPaths), progressbar.OptionSetDescription("[cyan][Decrypting files...][reset]"), progressbar.OptionSetWriter(os.Stderr), progressbar.OptionShowCount(), progressbar.OptionShowBytes(true), progressbar.OptionEnableColorCodes(true), ) for i := 0; i < len(inputPaths); i++ { err := DecryptFile(inputPaths[i], outputPaths[i], key) if err != nil { color.Red("Error decrypting: %v", err) } else { progress.Add(1) color.Green("\nDecryption successful for %s", inputPaths) } } progress.Finish() }, }
View Source
var EncryptCmd = &cobra.Command{ Use: "encrypt", Short: "Encrypt files", Long: "Encrypt files using AES-GCM encryption.", Run: func(cmd *cobra.Command, args []string) { color.Cyan("Encrypting files...") inputPaths, _ := cmd.Flags().GetStringSlice("input") outputPaths, _ := cmd.Flags().GetStringSlice("output") key := internal.GenerateKey() progress := progressbar.NewOptions(len(inputPaths), progressbar.OptionSetDescription("[cyan][Encrypting files...][reset]"), progressbar.OptionSetWriter(os.Stderr), progressbar.OptionShowCount(), progressbar.OptionShowBytes(true), progressbar.OptionEnableColorCodes(true), ) for i := 0; i < len(inputPaths); i++ { err := EncryptFile(inputPaths[i], outputPaths[i], key) if err != nil { color.Red("Error encrypting: %v", err) } else { progress.Add(1) color.Green("\nEncryption successful for %s", inputPaths) } } progress.Finish() }, }
Functions ¶
func CompressFile ¶
func DecryptFile ¶
func EncryptFile ¶
func NewRootCmd ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.