// Undo implements plan.Resource.
Undo implements plan.Resource.
// Undo implements plan . Resource .
func (d *Dir) Undo(runner plan.Runner, current plan.State) error {
	path := strings.TrimRight(d.Path.String(), "/")
	if _, ok := protectedDirs[path]; ok {
		return fmt.Errorf("deletion aborted because dir is blacklisted for deletion: %s", path)
	}
	var cmd string
	if d.RecursiveDelete {
		cmd = fmt.Sprintf("rm -rvf -- %q", path)
	} else {
		cmd = fmt.Sprintf("[ ! -e %q ] || rmdir -v --ignore-fail-on-non-empty -- %q", path, path)
	}
	_, err := runner.RunCommand(cmd, nil)
	return err
}
func ( d * Dir ) Undo ( runner plan . Runner , current plan . State ) error { path := strings . TrimRight ( d . Path . String ( ) , " " ) if _ , ok := protectedDirs [ path ] ; ok { return fmt . Errorf ( " " , path ) } var cmd string if d . RecursiveDelete { cmd = fmt . Sprintf ( " " , path ) } else { cmd = fmt . Sprintf ( " " , path , path ) } _ , err := runner . RunCommand ( cmd , nil ) return err }
Undo implements plan.Resource.
Undo implements plan . Resource .