feat: update

This commit is contained in:
yanghao05
2025-03-29 18:08:06 +08:00
parent a48a3b6a1f
commit 50ac4f816a

View File

@@ -55,10 +55,16 @@ func Serve(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.New("usage: compress path")
}
log.Infof("start compressing %s", args[0])
if err := commandCompress(args[0]); err != nil {
log.WithError(err).Errorf("compressing %s failed", args[0])
return err
}
ticker := time.NewTicker(5 * time.Minute)
for range ticker.C {
log.Infof("compressing %s", args[0])
log.Infof("start compressing %s", args[0])
if err := commandCompress(args[0]); err != nil {
log.WithError(err).Errorf("compressing %s failed", args[0])
@@ -93,6 +99,8 @@ func commandCompress(dir string) error {
continue
}
log.Infof("process file %s", file.Name())
// get the file name
fileName := file.Name()
filePath := filepath.Join(dir, fileName)