<commit_before>package cmd

import (
	"fmt"
	"log"
	"os"
	"path"
	"unicode/utf8"

	"github.com/spf13/cobra"
	"github.com/stormforger/cli/api"
)

var (
	datasourcePushCmd = &cobra.Command{
		Use:   "push <organization-ref> <file>",
		Short: "Upload a file",
		Run:   runDataSourcePush,
		PersistentPreRun: func(cmd *cobra.Command, args []string) {
			if len(args) < 2 {
				log.Fatal("Expecting one or more arguments: File(s) to upload")
			}

			if pushOpts.Raw && (pushOpts.FieldNames != "" || pushOpts.Delimiter != "" || pushOpts.FirstRowHeaders) {
				log.Fatal("Raw file fixtures do not support --fields, --delimiter and --auto-field-names")
			}

			if len(args) > 2 && (pushOpts.Name != "" || pushOpts.FieldNames != "") {
				log.Fatal("--name and --fields is not supported for multiple uploads")
			}

			if pushOpts.Name != "" && pushOpts.FirstRowHeaders {
				log.Fatal("--name and --auto-field-names are mutual exclusive")
			}

			if pushOpts.Delimiter != "" && utf8.RuneCountInString(pushOpts.Delimiter) > 1 {
				log.Fatal("Delimiter can only be one character!")
			}

			datasourceOpts.Organisation = lookupOrganisationUID(*NewClient(), args[0])
			if datasourceOpts.Organisation == "" {
				log.Fatal("Missing organization")
			}
		},
	}

	pushOpts struct {
		Raw             bool
		Delimiter       string
		FieldNames      string
		Name            string
		NamePrefixPath  string
		FirstRowHeaders bool
	}
)

func init() {
	datasourceCmd.AddCommand(datasourcePushCmd)

	// type of FF<commit_msg>--fields and --auto-field-names are mutual exclusive<commit_after>package cmd

import (
	"fmt"
	"log"
	"os"
	"path"
	"unicode/utf8"

	"github.com/spf13/cobra"
	"github.com/stormforger/cli/api"
)

var (
	datasourcePushCmd = &cobra.Command{
		Use:   "push <organization-ref> <file>",
		Short: "Upload a file",
		Run:   runDataSourcePush,
		PersistentPreRun: func(cmd *cobra.Command, args []string) {
			if len(args) < 2 {
				log.Fatal("Expecting one or more arguments: File(s) to upload")
			}

			if pushOpts.Raw && (pushOpts.FieldNames != "" || pushOpts.Delimiter != "" || pushOpts.FirstRowHeaders) {
				log.Fatal("Raw file fixtures do not support --fields, --delimiter and --auto-field-names")
			}

			if len(args) > 2 && (pushOpts.Name != "" || pushOpts.FieldNames != "") {
				log.Fatal("--name and --fields is not supported for multiple uploads")
			}

			if pushOpts.FieldNames != "" && pushOpts.FirstRowHeaders {
				log.Fatal("--fields and --auto-field-names are mutual exclusive")
			}

			if pushOpts.Delimiter != "" && utf8.RuneCountInString(pushOpts.Delimiter) > 1 {
				log.Fatal("Delimiter can only be one character!")
			}

			datasourceOpts.Organisation = lookupOrganisationUID(*NewClient(), args[0])
			if datasourceOpts.Organisation == "" {
				log.Fatal("Missing organization")
			}
		},
	}

	pushOpts struct {
		Raw             bool
		Delimiter       string
		FieldNames      string
		Name            string
		NamePrefixPath  string
		FirstRowHeaders bool
	}
)

func init() {
	datasourceCmd.AddCommand(datasourcePushCmd)

	// type of FF
{'fraction_non_alphanumeric': 0.1401107852720756, 'fraction_numerical': 0.005213424568263278, 'mean_word_length': 3.1825613079019073, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6306441', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1046, 'n_words': 232}