<commit_before>package backup

import (
	"fmt"
	"path/filepath"
	"strings"
	"time"

	"github.com/codeskyblue/go-sh"
	"github.com/pkg/errors"

	"github.com/stefanprodan/mgob/pkg/config"
)

func rcloneUpload(file string, plan config.Plan) (string, error) {

	fileName := filepath.Base(file)

	sectionName := plan.Rclone.ConfigSection
	if "" == sectionName {
		sectionName = plan.Name
	}

	upload := fmt.Sprintf("rclone --config=\"%v\" copy %v %v:%v/%v",
		plan.Rclone.ConfigFilePath, file, plan.Rclone.ConfigSection, plan.Rclone.Bucket, fileName)

	result, err := sh.Command("/bin/sh", "-c", upload).SetTimeout(time.Duration(plan.Scheduler.Timeout) * time.Minute).CombinedOutput()
	output := ""
	if len(result) > 0 {
		output = strings.Replace(string(result), "\n", " ", -1)
	}

	if err != nil {
		return "", errors.Wrapf(err, "Rclone uploading %v to %v:%v failed %v", file, plan.Name, plan.Rclone.Bucket, output)
	}

	return strings.Replace(output, "\n", " ", -1), nil
}<commit_msg>use the sectionname<commit_after>package backup

import (
	"fmt"
	"path/filepath"
	"strings"
	"time"

	"github.com/codeskyblue/go-sh"
	"github.com/pkg/errors"

	"github.com/stefanprodan/mgob/pkg/config"
)

func rcloneUpload(file string, plan config.Plan) (string, error) {

	fileName := filepath.Base(file)

	sectionName := plan.Rclone.ConfigSection
	if "" == sectionName {
		sectionName = plan.Name
	}

	upload := fmt.Sprintf("rclone --config=\"%v\" copy %v %v:%v/%v",
		plan.Rclone.ConfigFilePath, file, sectionName, plan.Rclone.Bucket, fileName)

	result, err := sh.Command("/bin/sh", "-c", upload).SetTimeout(time.Duration(plan.Scheduler.Timeout) * time.Minute).CombinedOutput()
	output := ""
	if len(result) > 0 {
		output = strings.Replace(string(result), "\n", " ", -1)
	}

	if err != nil {
		return "", errors.Wrapf(err, "Rclone uploading %v to %v:%v failed %v", file, plan.Name, plan.Rclone.Bucket, output)
	}

	return strings.Replace(output, "\n", " ", -1), nil
}
{'fraction_non_alphanumeric': 0.18321392016376664, 'fraction_numerical': 0.0030706243602865915, 'mean_word_length': 4.269541778975741, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5407869', 'n_tokens_mistral': 737, 'n_tokens_neox': 711, 'n_words': 144}