func NewCmd(db *bolt.DB, r io.Reader) *cobra.Command {
	opts := rmOptions{}
	cmd := &cobra.Command{
		Use:     "rm <name>",
		Short:   "Remove files from the database",
		Example: example,
		Args:    cmdutil.MustExist(db, cmdutil.File),
		PreRunE: auth.Login(db),
		RunE:    runRm(db, r, &opts),
		PostRun: func(cmd *cobra.Command, args []string) {
			opts = rmOptions{}
		},
	}
	cmd.Flags().BoolVarP(&opts.dir, "dir", "d", false, "remove a directory and all the files stored in it")
	return cmd
}
NewCmd returns a new command.
package rm
import (
	"fmt"
	"io"
	"path/filepath"
	"strings"
	"github.com/GGP1/kure/auth"
	cmdutil "github.com/GGP1/kure/commands"
	"github.com/GGP1/kure/db/file"
	"github.com/pkg/errors"
	"github.com/spf13/cobra"
	bolt "go.etcd.io/bbolt"
)
var example = `
* Remove a file
kure file rm Sample
* Remove a directory
kure file rm SampleDir -d`
type rmOptions struct {
	dir bool
}