This commit is contained in:
Shen Junzheng
2025-03-12 01:19:35 +08:00
parent 160040f3e1
commit 78cce92ce3
70 changed files with 10134 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
package chatlog
import (
"fmt"
"github.com/sjzar/chatlog/internal/chatlog"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(decryptCmd)
decryptCmd.Flags().StringVarP(&dataDir, "data-dir", "d", "", "data dir")
decryptCmd.Flags().StringVarP(&workDir, "work-dir", "w", "", "work dir")
decryptCmd.Flags().StringVarP(&key, "key", "k", "", "key")
decryptCmd.Flags().IntVarP(&decryptVer, "version", "v", 3, "version")
}
var dataDir string
var workDir string
var key string
var decryptVer int
var decryptCmd = &cobra.Command{
Use: "decrypt",
Short: "decrypt",
Run: func(cmd *cobra.Command, args []string) {
m, err := chatlog.New("")
if err != nil {
log.Error(err)
return
}
if err := m.CommandDecrypt(dataDir, workDir, key, decryptVer); err != nil {
log.Error(err)
return
}
fmt.Println("decrypt success")
},
}