empty

package
v0.0.0-...-dfbe3fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyCmd = &cobra.Command{
	Use:   "empty [path]",
	Short: "Recursively list empty folders on the PikPak server",
	Args:  cobra.MaximumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		path := targetPath
		if len(args) > 0 {
			path = args[0]
		}

		p := api.NewPikPakWithContext(cmd.Context(), conf.Config.Username, conf.Config.Password)
		if err := p.Login(); err != nil {
			fmt.Println("Login failed")
			logx.Error(err)
			return
		}

		emptyFolders, err := handleEmptyFolders(cmd.Context(), &p, path, concurrency, deleteMode)
		if err != nil {
			if errors.Is(err, context.Canceled) {
				fmt.Println("Empty folder scan canceled")
				return
			}
			fmt.Println("Handle empty folders failed")
			logx.Error(err)
			return
		}
		if len(emptyFolders) == 0 {
			fmt.Printf("No empty folders found under %s\n", path)
			return
		}
		for _, folder := range emptyFolders {
			if deleteMode {
				fmt.Printf("Deleted empty folder: %s\n", folder)
				continue
			}
			fmt.Printf("Empty folder: %s\n", folder)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL