rm

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cli.Command{
	Name:  "rm",
	Usage: "Remove files or directories",
	Flags: []cli.Flag{
		&cli.BoolFlag{Name: "recursive", Aliases: []string{"r"}, Usage: "Remove directories recursively"},
		&cli.BoolFlag{Name: "force", Aliases: []string{"f"}, Usage: "Ignore nonexistent files, never prompt"},
		&cli.BoolFlag{Name: "permanent, P", Usage: "Permanently delete (skip recycle bin)"},
	},
	Action: func(ctx context.Context, cmd *cli.Command) error {
		recursive := cmd.Bool("recursive")
		force := cmd.Bool("force")

		files := cmd.Args().Slice()
		if len(files) == 0 {
			return fmt.Errorf("missing file operand")
		}

		for _, file := range files {
			if err := remove(file, recursive, force); err != nil {
				return err
			}
		}
		return nil
	},
}

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