Skip to content

Commit

Permalink
delete: link user to no-prompt discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
odeke-em committed Oct 28, 2015
1 parent e13bf2c commit a17bbd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 10 additions & 4 deletions cmd/drive/main.go
Expand Up @@ -1088,22 +1088,28 @@ func (cmd *emptyTrashCmd) Run(args []string, definedFlags map[string]*flag.Flag)
}

type deleteCmd struct {
Hidden *bool `json:"hidden"`
Matches *bool `json:"matches"`
Quiet *bool `json:"quiet"`
ById *bool `json:"by-id"`
Hidden *bool `json:"hidden"`
Matches *bool `json:"matches"`
Quiet *bool `json:"quiet"`
ById *bool `json:"by-id"`
NoPrompt *bool `json:"no-prompt"`
}

func (cmd *deleteCmd) Flags(fs *flag.FlagSet) *flag.FlagSet {
cmd.Hidden = fs.Bool(drive.HiddenKey, false, "allows trashing hidden paths")
cmd.Matches = fs.Bool(drive.MatchesKey, false, "search by prefix and delete")
cmd.Quiet = fs.Bool(drive.QuietKey, false, "if set, do not log anything but errors")
cmd.ById = fs.Bool(drive.CLIOptionId, false, "delete by id instead of path")
cmd.NoPrompt = fs.Bool(drive.NoPromptKey, false, "disables the prompt")

return fs
}

func (cmd *deleteCmd) Run(args []string, definedFlags map[string]*flag.Flag) {
if *cmd.NoPrompt {
exitWithError(drive.PermanentDeletionNoPromptError)
}

sources, context, path := preprocessArgsByToggle(args, *cmd.Matches || *cmd.ById)

opts := drive.Options{
Expand Down
7 changes: 5 additions & 2 deletions src/help.go
Expand Up @@ -219,8 +219,11 @@ const (
InfiniteDepth = -1
)

var skipChecksumNote = fmt.Sprintf(
"\nNote: You can skip checksum verification by passing in flag `-%s`", CLIOptionIgnoreChecksum)
var (
skipChecksumNote = fmt.Sprintf(
"\nNote: You can skip checksum verification by passing in flag `-%s`", CLIOptionIgnoreChecksum)
PermanentDeletionNoPromptError = fmt.Errorf("%q is set yet performing a permanent deletion. Please see issue https://github.com/odeke-em/drive/issues/448", NoPromptKey)
)

var docMap = map[string][]string{
AboutKey: []string{
Expand Down

0 comments on commit a17bbd4

Please sign in to comment.